Working with document attachments
Document attachments can be associated with process instances.
These can be added through coach controls or through programmatic
additions.
The relevant JavaScript components are:
- TWDocument
- The description of a document.
- tw.system.findDocumentByID()
- Finds a document from its ID.
- TWProcessInstance.documents
- An array of
TWDocumentobjects associated with an instance of a process. - TWProcessInstance.addDocument()
- Adds a document to a process instance.
- TWProcessInstance.findDocuments()
- Locates documents associated with the current instance.
Note: The
addDocument() function will not work when called from JavaScript locally coded in a BPD activity but works fine when coded in a general service.Using the addDocuments() method
The
addDocuments() method
has the following parameters:- type (String)
- Either
TWDocument.Types.URLorTWDocument.Types.File. - name (String)
- Name of the document.
- fileLocation (String)
- The path to the file on the server or URI.
- hideInPortal (Boolean)
- A flag which describes whether or not the document is to be visible in Heritage Process Portal.
- createdBy (TWUser)
- properties (Map)
The following code sample illustrates how to use the
addDocuments() method.var myMap = new tw.object.Map();
var hide = false;
var user = tw.system.user;
tw.system.currentProcessInstance.addDocument(
TWDocument.Types.File,
"name",
"C:\\Projects\\WLE\\Images\\ibm.jpg",
hide,
user,
myMap);