Action: Add, Update and Remove attachment

Facebooktwitterpinterestlinkedinmail
Applies to version 2016.1.x; Author: Jakub Okrzesik

WEBCON BPS 2016 introduced (among other things) 3 new actions which can be used to heavily automate managing attachments on workflow instances. These 3 actions can add, remove or modify workflow instance attachments according to their configuration. Below you will a detailed description on how to correctly configure and use these actions.

 


1.  Add attachment action

This action(as the name suggests) adds single or multiple attachments to a workflow instance. There are two methods of selecting source files: based on instance ID and based on SQL query. The advanced configuration screen for the add attachment action can be seen below.


When the “Based on instance ID” mode is chosen, the corresponding section will become active and following parameters can be configured there:

  • Instance ID – from which the attachments will be loaded (you can type the ID manually, or use a variable which will send the ID).
  • Category – from which the attachments will be loaded.
  • Dropdown for selecting whether to load the newest, oldest, or all attachments.
  • Field for entering a regular expression, for filtering which attachments to load.

In the example below, the action is configured to copy attachments from the workflow instance whose ID will be obtained from the “Related document ID” form field. Only attachments that belong to the “Test category” will be copied.


When selecting attachments via SQL, there are two ways of formulating this query:

  • If the attachments we wish to add already exist as attachments on other workflow instances stored in the BPS database, then the query must return attachment ID’s from the WFDataAttachmets table. Here is an example of such a query:


  • An entirely new attachment can be created via SQL query. For this to work, the query must return at least two columns: FileName – containing the file’s name, and Content – which contains the attachment’s binary data. Such a query can also be used to load attachments that are being held in an external location, e.g. another system. Here is a sample query:

 

There are also two sections used for defining the behavior of the source and result files after they have been added to the workflow instance. This configuration is not related to the file selection method in any way.

Source files settings – This section defines what will happen with the source files once they have been added to the workflow instance. Copy will simply replicate the attachment on the target instance, while Move will delete the attachment from the source instance after they are added to the target instance. The third option will Verify whether the user that triggered the action has permission to access the source files.

Destination files settings – This section is used for defining the category to which added attachments will be assigned. The Overwrite option will overwrite existing attachments if an attachment with an identical name is added to the workflow instance.

 


2.  Update attachment action

This action can be used to modify an attachment’s parameters:

  • name,
  • description,
  • category

There are three methods for specifying which attachments are to be modified:

  • By specifying an attachment category,
  • Regular expression,
  • SQL query that will return attachment IDs from the ATT_ID column of the WFDataAttachments table. The attachments don’t necessarily have to be located on the workflow instance that triggered the “Update…” action.

The screenshot below shows a sample configuration for this action. In this case, the attachments that will be modified are taken from the parent instance of the workflow instance that triggers the action.

 


3.  Remove attachment action

The “Remove attachment” action can be configured to delete any number of attachments from a workflow instance. The methods for selecting attachments that will be removed is identical as with the “Update…” action, i.e.:

  • By specifying an attachment category,
  • Regular expression,
  • SQL query that will return attachment IDs from the ATT_ID column of the WFDataAttachments table. The attachments don’t necessarily have to be located on the workflow instance that triggered the “Remove…” action.

In addition to defining how attachments will be selected, there are also 3 removal modes to choose from:

  • Remove attachment and leave attachment’s history – The attachment will be removed from the workflow instance but its historical versions can still be found in the instance history.
  • Remove attachment and all binary data – The attachment is deleted from the workflow instance, historical data is also deleted from the database.
  • Remove only history of binary data – The attachment remains on the workflow instance, but historical data is deleted from the database.

The screenshot below shows a sample configuration for the “Remove…” action, in which only the oldest attachment from the “Test category” will be deleted. However, its historical versions can still be found and downloaded from the instance’s history.

Leave a Reply

Your email address will not be published. Required fields are marked *