Try OpenEdge Now
skip to main content
BP Server Developer's Guide
Dataslot management : Working with different types of dataslots : Document dataslots : Storing document dataslot attachments in external location
 
Storing document dataslot attachments in external location
Typically, the documents attached to Document dataslot are stored in a Business Process Server (BP Server) proprietary folder structure. However, you can change this location and store documents attached to Document dataslot to an external location as per your requirement in any DMS.
You can change the Document dataslot attachment’s location to a custom folder structure in a DMS in following scenarios:
*In any BP Server and Web (BPM Web Flow) application
*In a Start workstep before creating an instance
*In any intermediate activity or adapter workstep
*In a standalone Web (BPM Web Flow) application
To allow document storage of a document dataslot to a custom path:
1. You must set the oebps.dataslotstorage.custompath.enable parameter in the OEBPS_HOME\conf\oebps.conf file to true (by default, it is set to false).
When this parameter is set to true, the application developer can set the document path for the Document dataslots using the pre or post scripts. BP Server provides functions/methods to achieve this.
2. You must pass the Document dataslot name and document path expression to these functions.
The document path expression may contain the Character and/or Integer dataslots.
The values of these dataslots are evaluated at runtime and replaced in the path expression to get the actual path. The script function takes care of creating the folder structure (if it is not already created) and setting its location as the path for the Document dataslot passed.
On subsequent document attachments to that dataslot, the documents are stored in the folder location specified in the script function. Note that if a document is attached to a dataslot before executing a script, then that document is stored in the BP Server proprietary folder structure.
Note: After you set a folder path for a Document dataslot, you cannot change it again.
Note: The Archiver cannot purge the documents saved in a custom location. Also, after you uninstall a business process template, the documents having custom path are not purged.
Limitations
The custom document path is not supported for the Document dataslots containing default documents.If the same custom folder path is used for a Document dataslot in more than one process instances, then the the documents attached to such dataslots are stored in the same folder. Therefore, when multiple users simultaneously edit the same document in subsequent worksteps, the document is overwritten, and only the changes made by the last user are stored.
Examples
This section covers examples of how to use script to set custom path for Document dataslot:
*For BP Server application, to attach documents to intermediate worksteps, run the following script in the Start post-script or in pre/post-script of the Activity workstep that is occurring before the workstep that has docDS as its input/output field.
jst.setDocumentPath("docDS",
"companySales/products/${productName}/${orderId}", false);
where productName is a String dataslot and orderId is a Number dataslot.
*For Web (BPM Web Flow) application, to attach documents to intermediate worksteps, run the following script in pre/post-script of Activity workstep that is occurring before the workstep that has docDS as its input-ouput field.
UtilityBean.setDocumentPath("docDS",
"companySales/products/${productName}/${ordered}", bean, false);
where productName is String dataslot and orderId is a Number dataslot.
*To attach documents to the Start workstep, Start workstep must use a private or public Web (BPM Web Flow) application. In the Web application, you can run the script in post-script in ‘Activity 1’ and in the next activity, you can attach the documents to the dataslot.