cancel
Showing results for 
Search instead for 
Did you mean: 

Using hwc.showAttachmentContents

Former Member
0 Kudos

Hello,

Can anyone please let me know how to use the hwc.showAttachmentContents function in SUP 2.2 SP4?

I have an attachment that I would like to automatically show when moving from the list view to the list details screen,

The list contains all the information about the attachment (MIME, FILENAME, BINARYdata).

What my app does is gets the information of the attachment when I click the menu button show attachment. It then returns the data in a list. I would like it to show the attachment when I go from the list view screen to the details screen.

The method I am using to do this is:

hwc.customBeforeShowScreen = function(screenToShow, screenToHide) {

          if (screenToShow == "AttachDetail"){

                         var form = document.forms[screenToShow + "Form"];

        if (form) {

          var mvc = getCurrentMessageValueCollection();

          var binary = mvc.getData("Attach_ATTACHMENT_attribKey");

          var mime = mvc.getData("Attach_ATTACHMENTMIMETYPE_attribKey");

          var file = mvc.getData("Attach_FILENAME_attribKey");

         

          hwc.showAttachmentContents(binary, mime, file);

        }

         

          }

    return true;

};

When I click on the list I get the error "Invalid Attachment Data". Can anyone help with this please?

Thank you

Jared

Accepted Solutions (1)

Accepted Solutions (1)

midhun_vp
Active Contributor
0 Kudos

use the code alert ("step 1"); .... i between your custom code. Also check once you click on the list item the data is populating , ex: alert ("Value"+Attach_ATTACHMENT_attribKey)

So you could know that when this method triggers and what is the value at that time. Move the code to other functions and check when it succeeds.

- Midhun VP

Former Member
0 Kudos

Hi Midhun,

If I use this code for eg:

var mvc = getCurrentMessageValueCollection();

          var binary = mvc.getData("Attach_ATTACHMENT_attribKey");

          alert("1" + binary);

I get the alert message saying "1 object object" So it doesn't give me a value.

If i use:

     var binary2 = form.Attach_ATTACHMENT_attribKey.value;

     alert("2" + binary2);

I dont get a return at all. Which is the correct method to use to get the data bound to a variable?

midhun_vp
Active Contributor
0 Kudos

Check this

var binary = mvc.getData("Attach_ATTACHMENT_attribKey").getValue();

Former Member
0 Kudos

Hi Midhun,

Im still having problems but testing out some more things to try get a value back. Can I please ask you to look at this link : http://www.mgearhart.com/wp-content/uploads/2012/03/supimage1.pdf

On pg 5 this guy shows how to autoload his pictures. I was hoping if you had a look at this you can change his code from using an image to using pdf.

Thank you

Former Member
0 Kudos

Hello,

I got this working with the below code:

var mvc = getCurrentMessageValueCollection();

var binary = mvc.getData("Attach_ATTACHMENT_attribKey").getValue();

var mime = mvc.getData("Attach_ATTACHMENTMIMETYPE_attribKey").getValue();

var file = mvc.getData("Attach_FILENAME_attribKey").getValue();

       

hwc.showAttachmentContents(binary, mime, file);

Thank you for your help Midhun!

Answers (0)