Pre-requisites:
Required role privilege 'Manage Workflow Rules' on the project where a workflow trigger needs to be created.
Steps to create a workflow trigger event on a document is as mentioned below:
You have an option to configure a workflow trigger for files right after publishing a workflow from the workflow designer. In such a case, you will get a prompt message stating 'Do you want to configure a Trigger now?'. Here, click on 'Yes' option and follow the steps as below - from step number 3 onwards.
1. Navigate to 'Workflows' tab and select the project.
2. Click on 'Create Trigger' button to start creating a trigger event.
Alternately, right click on project name and select 'Create Trigger' option.
3. Enter required details for all the mandatory fields in 'Configure Trigger' screen:
3.1. Name - Name of the trigger.
3.2. Priority - At any given point of time, only one running workflow is allowed on a document. Below are the key factors to be considered while setting the priority of a workflow:
A new workflow can get kicked off on a document only when the earlier workflow is completed.
To decide which trigger gets precedence when there are multiple triggers with matching conditions, you can use the priority field. The trigger with higher priority will be kicked off first, then the triggers with lesser priorities will be kicked off one by one.
All the triggers will execute which are configured with system tasks event, while only one trigger will execute which is configured with workflow definition event.
If there are more than one triggers with matching conditions and priority, then any one of them will get kicked off. In case this particular trigger fails, the next trigger with matching condition would be initiated right away.
In case of 'Pre' task mode, only one trigger will execute having higher priority irrespective of the number of triggers with matching conditions.
3.3. Description - A brief description about the trigger to be created.
3.4. Context - Select the trigger context as 'Document'.
3.5. Trigger Conditions - You can create various trigger conditions using 'AND' / 'OR' (logical operators). Workflow triggers for files can be created by using combinations of folder, purpose of issue, document status and configurable attributes set up in a project.
Rule is the single logical statement created based on one or more conditions defined by the user.
The trigger is executed based on this statement under different matching conditions. You can see the actual rule (statement) that will get applied based on the conditions defined for workflow trigger just like below:
Different brackets and text colors used to present the 'Applied Rule' can make it easy for you to understand how the workflow trigger would actually get applied based on the conditions entered, irrespective of the complexity of the rule.
Working of logical operators:-
------------------------------------------------------------------------------------------------------------------
<Condition 1> <logical operator (AND)> <Condition 2>
Description:- For 'AND' logical operator, both conditions must be satisfied (true).
<Condition 1> <logical operator (OR)> <Condition 2>
Description:-
For 'OR' logical operator, any condition should be satisfied (true).
------------------------------------------------------------------------------------------------------------------
If I want the workflow to trigger when any revision is uploaded in folder named 'Architecture' having status 'Design Draft', I need to select:
Condition One: Folder is equal to 'Architecture' AND
Condition Two: When file status is 'Design Draft'
You can use combination of logical operator to cover a business process.
Example
<Condition 1> <logical operator (AND)> <Condition 2> <logical operator (AND)> <Condition 3> <logical operator (OR)> <Condition 4>
Description:- Above scenario should work as:
{( <Condition 1> <logical operator (AND)> <Condition 2> <logical operator (AND)> <Condition 3>) <logical operator (OR)> <Condition 4>}
If I want the workflow to trigger when any revision is uploaded in folder named 'Architecture' having purpose of issue as 'A' or 'B' and when the status of document is X or Y...
Condition One: When purpose of issue is 'A' OR
Condition Two: When purpose of issue is 'B' AND
Condition Three: When file status is 'X' OR
Condition Four: When file status is 'Y' AND
Condition Five: Folder is equal to 'Architecture'
Interpreted As: (poi=A OR poi=B) AND (status=X OR status=Y) AND (folder=Architecture) - Correct Way
System automatically uses parenthesis (brackets) starting from left for same logical operator.
The logic for parenthesis is as below:
Start with a bracket for the first field and as long as you get the same operator don’t close the bracket. When the operator changes, close the bracket and start a new bracket.
Example
A = 2 or A = 4 and C = 3 or C = 5 and B = 1 will be interpreted as (A = 2 or A = 4) and (C = 3 or C = 5) and (B = 1)
Suppose workflow has to be kicked off when user uploads a document in folder 'A' having either document status as 'S1' or purpose of issue as 'P1', then the same has to be configured as mentioned below:
Folder == A AND Status == S1 OR POI == P1 - Interpreted as (Folder ==A AND Status == S1) OR (POI == P1) - Wrong way
Status == S1 OR POI == P1 AND Folder == A - Interpreted as (Status == S1 OR POI == P1) AND (Folder == A) - Correct way
Folder name is kept as 'Design' & document status as 'Review' for explanation.
1) Folder == Design AND Status == Review
If both condition true then and only then workflow should be triggered.
2) Folder == Design OR Status == Review
If any condition true then workflow should be triggered.
3) Folder == Design AND Status == Review OR POI == For Acceptance
System uses braces as {(Folder == Design AND status== Review) OR (POI == For Acceptance)}
In this scenario, workflow will be triggered only if either (Folder == Design AND Status == Review) is true or (POI == For Acceptance) is true.
(If you want the design folder to remain common then first the conditions needs to be added for document status and purpose of issue and then use the folder condition with AND operator at the end i.e. Status == Review OR POI == For Acceptance AND Folder == Design)
Click here for detailed help on how to use independent system tasks.
3.6 Trigger Event - Select appropriate event which should trigger the workflow (as configured by user). Trigger event for files can be:
3.7. Task Mode - Select the task mode either 'Pre', 'On-Load' or 'Post' for which this trigger will be used.
Pre - An event which is executed before completion of desired event i.e. upload of a document or creation of an app. System tasks with pre task mode can be created by using groovy scripts only. Pre task mode is currently available for following events:
Publish Documents, Edit Attributes, Download Document, Print Document, View DocumentOn-Load - An event which is executed just before the event specific page / screen loads in user interface i.e. edit status page load or download document page load. System tasks with on-load task mode can be created by using groovy scripts only. On-load task mode is currently available for following events:
Publish Documents, Change Status, Edit Attributes, Download Document, Create Discussion, Create Discussion Reply, QR Code ScanPost - An event which is executed after completion of desired event i.e. upload of a document or creation of an app. Post task mode is currently available for following events:
Publish Documents, Change Status, Static Link, Edit Attributes
3.8. Task Type - Select the type of task to be performed based on the selected trigger event and task mode.
3.9. Task - Select relevant system task if this trigger is for an independent system task or select relevant workflow definition if this trigger is for a workflow.
4. Click on 'Create' to complete creating a trigger event for the workflow on document.
Check: FAQs
Next Article: Create a Workflow Trigger for Forms (in a Project)