Adding a Business Rules Task
Typically a workflow diagram determines the sequence of steps/tasks that happen in a particular order, however it may be required sometimes that some tasks are skipped or some tasks must be completed depending on data recorded on the form. For e.g in Document Control, if the Document Type is Record then no approval or review is required and the Record can be sent straight to Approved.
Follow the steps below to modify the workflow. In this example we will add a task between Draft and Review, the task shall be a Business Rule that allows the workflow to be completed if the Document Type is Record.
Step 1. Open the Camunda Modeler and download and open the workflow file (BPMN File) from the relevant Process Setting.
↓
Step 2. The workflow is loaded with all tasks from the workflow
Step 3. Make changes by adding atask in between the Draft and Review Step.
- Delete the Connector between Draft and Review
- Drag and drop a task from the Floating Tool bar in between Draft and Review
- Double click on the Task and give it a name {Business Rule} and use the Connector tool to connect arrows between Draft, {Business Rule}, Review and Approved.
- IMPORTANT: Select the {Business Rule} Task and ensure that you click on the Change Type action to change the Task type to Business Rule Task
↓
Step 4. Click on save and store the file in a location from where it is easily accessible so that it can be attached back into the Process Setting
Step 5. Open the relevant Process Setting, remove the existing BPMN File and replace it with the file you have downloaded above. Save the Process Setting.
↓
Step 6. The changes are applied and the new Task shall be added at the end of the Tasks Section in the Process setting. Save the Process again to refresh the Task so that it adds default settings for it.
Step 7. Click on the Task Link under Task Name this shall open the Task Setting, navigate to the Business Rule runs when field.
If set to Document is refreshed, then the business rule shall be evaluated every time the Document is refreshed. In such case the Business Rule Task must be positioned just after the first Task of the workflow.
If set to Document is saved, then the business rule shall be evaluated every time the Document is saved. In such case the Business Rule Task must be positioned just after the first Task of the workflow.
If set to User Task is refreshed, then the business rule shall be evaluated every time the Task related to the Business rule is refreshed (this is the most commonly used and recommended option). In such case the Business Rule Task must be positioned just after the Task after which the business rule must be run on the workflow.
If set to User Task is saved, then the business rule shall be evaluated every time the Task related to the Business rule is saved. In such case the Business Rule Task must be positioned just after the Task after which the business rule must be run on the workflow.
Step 8. In this particular example, we shall set this field to User Task is refreshed as we only wish for the Business rule to be evaluated in the first step (and only in the first step) of the workflow. Once the field is set proceed to the Define Business Rules Section
Following fields shall be displayed:
Field |
Description |
If Field |
Displays all field (Design Names) in the form, this is the field whose value shall be tested to determine what the decision is |
Condition |
Comparison type: CONTAINS, DOES NOT CONTAIN, DOES NOT EQUAL, EQUALS, GREATER THAN, LESSER THAN |
This Value |
Checks the value against the above Field using the Comparison Type as the manner of comparison. |
Then perform this action |
Options:
|
Next Phases |
Displays a list of all available User Tasks (normal steps) |
Read Only Sections |
Displays a list of all sections |
Visible Sections |
Displays a list of all sections |
Step 9: Set the business rule as shown below, this shall check the value of the Type field on the Document and if the value is Record then the next step shall be the last step (Approved) or if not true the next step shall be Review.
Step 10. Test the workflow, set the Document Type as Record and save or refresh the record, the Workflow changes to show the next step as Approved.
Set the Document Type as NOT Record and save or refresh the record, the Workflow changes to show the next step as Review.