Designer > Attachments > Attachment Custom Function Examples
  

Attachment Custom Function Examples

The following examples of using custom functions show the manipulation of attachments in copy operations of assign activities. For a detailed description of each function, see Custom Functions for Manipulating Attachments.
Example 1:
Copies the first attachment from the incomingMessage variable to the resultMessage variable. The return value of copyAttachment is copied to the unused tempVar.
<copy>
<from>abx:copyAttachment
("incomingMessage",1,"resultMessage")
</from>
<to variable="tempVar"/>
</copy>
Example 2:
Removes the (N - 1) attachment; that is, removes the second-to-last attachment from the resultMessage variable, where N is the count of attachments on resultMessage.The return value of removeAttachment is copied to the unused tempVar.
<copy>
<from>abx:removeAttachment("resultMessage",
abx:getAttachmentCount("resultMessage") - 1 )
</from>
<to variable="tempVar"/>
</copy>
Example 3:
Copies the value of the Content-Transfer-Encoding property of the first attachment to the resultMessage variable.
<copy>
<from>abx:getAttachmentProperty("resultMessage" , 1 ,
"Content-Transfer-Encoding")
</from>
<to part="propResult" variable="resultMessage"/>
</copy>