Attachments as retrieveData() return values

Sometimes, it is preferable be return an attachment from retrieveData(). The logic to create and/or retrieve an attachment is implementation-specific, but after the attachment is known, its information can be returned.

To provide an attachment, retrieveData() returns an object like:

{
       contents: "attachment-sys-id",
       contentType: "sys_attachment"
}
An example that extends on the previous example, but saves the response body of the REST Message to the integration process record follows. It then returns that attachment identifier as the contents of the return object.
Figure 1. Return attachment from retrieveData
Sample script with attachment as retrieveData() return value