NextGen Knowledge Center

Extract Attachments

Use the following method to extract and store attachments from the attachment script:

The resulting Attachment object contains the ID you need to inject back into the message. For more information, look at the User API. The return value for the JavaScript attachment script should be the final message string, with any attachments extracted out and replaced with attachment replacement tokens.

addAttachment(data, type)

Creates and stores an attachment for the current message.

Table 1. Parameters
NameTypeDescription
dataString or Byte arrayThe actual attachment data to insert. Man be either a String or a byte array. If a string is used, it is assumed to be a Base64 encoded representation of the actual attachment data.
typeStringThe MIME type of the attachment. For additional information see Attachment Handlers.
<Return Value>AttachmentThe inserted Attachment object.
The resulting Attachment object contains the ID you need to inject back into the message. For more information, look at the The User API (Javadoc). The Return Value for the JavaScript attachment script should be the final message string, with any attachments extracted out and replaced with attachment replacement tokens.