Check if a related workflow is in particular status
If your workflow is complex enough, you can break it up into a few simple processes. For example, a business trip execution process might be simplified in the following way:
- Travel request – the master process.
- Travel order – the subprocess, containing gathering detailed information about the trip, booking etc.
- Expenses report - the subprocess required to submit an expenses report for approval.
To run the processes in the right order, you should connect them with references, and set validation rules. Validation rules will help you to check, whether the related subprocess is in particular status or not. To retrieve particular data from a related item, use the following expression pattern:
|$<Reference_Field_ID> -> <Related_Item_Field_ID>|
<Reference_Field_ID> - the identifier of a field which references to another item.
<Related_Item_Field_ID> - the identifier of any field of the referenced item.
To connect the processes:
1. Assuming that the templates were previously created and configured, go to a respective workspace and select the Travel request app.
2. Click Fields.
3. Create the fields Travel order (ID: Travel_order) and Expenses report (ID: Expenses_report) of the Reference type. Select the appropriate apps as references. Click Save.
4. Go to Form and drag the created fields to the workflow task form. Save the changes.
To set validation rules:
1. In the Travel request app go to Workflow.
2. Find the step of the Travel request master process on which the related Travel order should be Verified by Manager (ID: wfstate.verifiedBoss).
3. Open the transition, which follows this step and connects it with the next step in the master process.
4. Go to Validation Rules and click Add Rule.
5. Type the following expression in the built-in expressions editor:
6. Type the rule name and the validation message that will be displayed, if the the related Travel order has not been verified yet. Click Save.
7. Return to the workflow diagram and find the step of the Travel request process on which the related Expenses Report should be Verified by Manager (ID: wfstate.verifiedBoss). Perform the steps 3-6 and use the following expression for the Expenses Report:
To check how it works:
1. Create new workflow tasks Travel request, Travel order and Expenses report.
2. Connect them using the reference fields.
3. Move the Travel request workflow task through workflow.
4. On performing the required transition of the Travel request the validation message will be shown to you, if the related workflow task is not verified by manager.