Applies to version 8.0.x; author: Kamil Nędza
Workflow control (Branch) allows you to follow a selected path on the basis of a preset condition.Thanks to that you create clear and intuitively operating workflows in a very easy way and without unnecessary actions. Controlling the workflow lets you:
- skip unnecessary steps
- decide who the task shall be assigned to
- withhold the document in the current step until a given factor is met
Branches have many more applications. This article presents examples for the above-mentioned functionalities. The operation and configuration of Branches will be presented in individual scenarios.
Example No. 1
In the company absence workflow you want the document to be moved on to an appropriate step depending on the type of absence. When you select”Holiday leave” or “Leave on demand”, the document should be sent to a selected substitute. When you select “Teleworking”, the document should skip this step and be immediately forwarded to a supervisor for approval.
An example of a simple absence workflow is shown in Figure 1.
Figure 1. “Absences” workflow diagram
Right after registration, the type of absence is checked. Depending on the type it is determined if the document should be sent to the substitute or directly to the supervisor.
Now you enter the workflow control edit function:
Figure 2. View of the “Absences” workflow
Next, on the paths you configure the recipient of the task. In case of the “YES” path, the task will be sent to the supervisor. In case of the “NO” path, the task will be sent to the substitute for acceptance. An example configuration is presented in Figure 3. Similarly, we configure the “NO” path by assigning the task to the person from the ”Substitute” attribute .
Now go to branch configuration by clicking “Workflow control”. The configuration can be done in two ways:
- On the basis of attribute value
- On the basis ofSQL query
In this case, the path selection has been configured based on the value of the form field. The correct configuration is shown in Figure 4.
In Figure 5 you can see that the ID assigned to teleworking is number 3. That is why we check in the condition if ID equals 3. If yes, it means that teleworking has been selected, and the document will follow the “YES” path and will be sent to the supervisor. If the ID does not equal 3, the document will follow the “NO” path and will be sent to the substitute.
Figure 6: Registration of absences
Figure 7. Document in the “Accepted of the supervisor” step
In the above Figures you can see that the document has been registered with the “Teleworking” type of absence. This means it went directly to the supervisor, skipping the “Accepted of deputy” step.
Example No. 2
Depending on the selected report type, the document should be sent to a specified group of people. If you choose “Technical fault”, it will be sent to the “Technical support” group. If “Complaint” is selected, the document will be sent to “Customer Service”.
An example of customer reports flow is shown inFigure 8.
As you can see, after registration the document is sent to the workflow control. In this step, you must complete the path selection parameter.
Before we move on to the Branch configuration, let’s look at the configuration of the “Report type” form field:
Figure 9. Configuration of the “Report type” form field
We then move on to the configuration of workflow control. In order to do carry it out, click on the “Customer reports” flow. In the “Definition and steps” tab select the control of the workflow that you want to configure and click “Edit”.
Figure 10. View of the “Customer reports” flow.
In the “Workflow control” tab you configure conditions that will determine which path the document will follow. In this case, path selection will be based on the value of the “Report type” form field.
Figure 11: Branch configuration
Now you only need to configure the assignment of tasks to appropriate groups on the paths. Go to the “Paths” tab. Click on “Task creation” and set the recipient that the task will be sent to.
Figure 12. Setting task assignment for reporting a fault
Figure 13. Setting task assignment for reporting a complaint
Verification of the functionality
In the “Technical support” group on the website there is an employee Tomasz Sluszniak. Paweł Jawien is a member of the “Customer Support” group.
We register the documents and check who the task has been assigned to.
Figure 14. Task assignment for reporting a fault
Figure 15. Task assignment for reporting a complaint
To verify, click on the “Item history” link in the lower left corner and see the course of the workflow control:
Example No. 3
You have a sample budget flow. It contains a list of items to which you add expenses covered by the budget. You want the flow to close automatically when all the funds have been spent.
For the purpose of showing you the functionality, we have created a simple Budget workflow whose scheme has been presented in Figure 17.
Figure 17. Budget workflow diagram
On the “Create” path the value of the “Other funds” attribute is initialized with the value of the “Initial amount” attribute. In turn, the “Add expense” path comprises the action of counting the remaining funds. The condition is then checked on the workflow if all the funds from the budget have been used – if not, the document will remain in the “Budget implementation” step. However, if all the funds have been spent, the document will go to the final “Completed” step.
Figure 18. Configuration of the action on the “Create” path which copies the contents of “Initial amount” to “Other funds”
Figure 19. Configuration of the action counting the remaining funds in the budget
Now we present the Branch configuration based on the SQL query. The logic of the query operation mode is as follows: If the remaining funds are zero or less (they are not greater than zero), the document will go the “YES” path (budget implemented). Otherwise, it will go to the “NO” path (budget has not been implemented).
Figure 20. Configuration of the action counting the remaining funds
Verification of the functionality
You register a new document of the budget workflow on the site:
Figure 21. Document registration form
Once the document has been created and is already in the “Budget implementation” step, you can add expenses. We have added two expenses – Photocopier paper and Office chair, which did not use up the entire budget and the “Add expense” path has been clicked.
Figure 22. Adding expenses to the budget
As you can see, the document still remains in “Budget implementation” step.
Figure 23. Verification of the budget after adding expenses
After adding another expense – the toner, it turned out that we have used up the entire budget. After clicking “Add expense”, the document automatically goes to the final step “Completed”.
Figure 24. Verification of the budget after using up all the funds