Fuego.Lib : Attachment

The Attachment component allows you to manage file attachments of the current process instance. You can create new attachments to current process instances as well as obtain information about existing file attachments, such as the name of the participant who edited the file, and the date and time when the attachment was edited.

Every process instance includes the attachments predefined variable, which is as an array of Attachments.

You can get the Binary contents of the attachment with the contents attribute.

Note: Do not use the Attachment component as argument to a process. If you do so, the actual contents of the attachment will not be available in the receiving process.

Information about each version of the attachment is available in the versions attribute, which is of type AttachmentVersion. The AttachmentVersion component provides information such as the author, timestamp, description, file size, comments, and so on.

Example 1: Creating an Attachment

binaryContent = BinaryFile.readToBinaryFrom(name : "C:/tmp/attachexample.txt") 
create Attachment 
     using contents = binaryContent, 
         name = "attachexample.txt", 
         description = "This file was in /tmp", 
         remarks = "Remark: this attachment was attached automatically" 

Example 2: Displaying Attachment Metadata

for each a in ProcessInstance.attachments 
do 
     logMessage "Attachment: " + a.fileName + "\n" + 
     "\nDescription: " + a.description + 
     "\nRemarks: " + a.remarks + 
     "\nCreator: " + a.creatorName + 
     "\nCreation Time: " + a.creationTime 
end 

Example 3: Displaying Additional Attachment Metadata

do 
     attcontent = String(a.contents, encoding : "UTF8") 

     logMessage "Attachment: " + a.fileName + "\n" + 
         "\nContents: " + attcontent + 
         "\nContent size: " + a.contentSize + 
         "\nContent type: " + a.contentType + 
         "\nVersion: " + a.version + 
         "\nVersions: " + a.versions[0].remarks + 
         "\nEdition Time: " + a.editionTime + 
         "\nEditor Name: " + a.editorName 
end 
Related reference
Fuego.Lib : AttachmentVersion
Fuego.Lib : ProcessInstance