Advanced configuration of the wait for sub-workflows step using SQL query. Advanced subworkflows settings.
The wait for sub-workflows steps allows for easy and quick configuration of processes in which we deal with dependent sub-workflows. Thanks to this, we can quickly determine how the main workflow should behave depending on the behavior of sub-workflows. However, in many cases, the basic configuration is insufficient and an advanced configuration is required. Here’s how it works.
How advanced configuration works
In the advanced configuration, create an SQL query that will return the identifier of the transition path on which the main workflow is to use, based on the given conditions.
Completed SQL query will be run automatically every time when:
- Main workflow will enter the wait for sub-workflows step
- Any dependent sub-workflow enter final step (positive or negative)
Usage scenario
Two workflows have been configured. One main flow in which we define acceptors and the weight of their votes. After the decision makers are indicated, the workflow goes to the wait for sub-workflows step to determine if at least 50% yes votes have been collected. If at least 50% of the votes are yes, the main workflow is to go to the “Positive” step. In case that more than 50% of the votes are voted for, the main flow is to go to the step called “Negative”.
Advanced configuration – SQL query
Below is the SQL query prepared by me.
- The query returns the path to the “Positive” step if the sum of the weight of the yes votes is greater than or equal to 50%.
- If the sum of the weights of the “no” votes exceed 50%, the workflow will go to the “Negative” step.
- In all other cases, the query does not return any path, so the main workflow remains at the wait for sub-workflows step.