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.
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.
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"
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
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