Use the Conditional Threshold block in workflows when you want actions to be completed when the threshold is reached and when the threshold isn't reached.
Creating the workflow
- From the menu, click Configuration > Workflows.
- Click Add (+).
- Select a module, for example, Assets.
- Enter the name and a description of the workflow.
Editing the Begin block
Specify the criteria needed to trigger the workflow in the Begin block.
- Edit the Begin block
- Add rules to trigger the workflow, for example:
- The Actions dropdown is set to Schedule
- The Barcode field is not Empty
- Click Save.
Adding the Conditional Threshold block
- Click Blocks, and drag and drop the Conditional Threshold block onto the canvas.
- Click Edit.
Basic Mode
The Conditional Threshold block opens in Basic Mode.
In Basic Mode you can do the following:
- Enter a meaningful name for the block.
- Select a field to compare against, such as Barcode
- Select an Operator such as Equals.
- From the Compare to list, select Field or Value
- If you selected Field, enter the field you wish to compare it against.
- If you selected Value, enter the threshold Value in text format. This field does not support Jinja syntax.
- Click SAVE.
If you wish to specify multiple conditions or create a more complex query, click Advanced Mode.
Advanced Mode
In Advanced Mode you can do the following:
- Enter a meaningful name for the block.
- Enter a logical expression using Jinja syntax following the examples provided below. When entering your expression make sure that:
- The logical expression appears on one line
- The syntax is correct
- The field name is correct. Tip: Click Add Metadata
to verify the field name. Even though a field is renamed, it will still follow the old naming convention, that is, the barcode could be oomnitza_barcode.
Important
You cannot switch from Advanced Mode to Basic Mode once you have entered a Jinja expression.
Examples
{% if barcode == "LX008888" %}True{% else %}False{% endif %}
{% if barcode|length > 1 %}True{% else %}False{% endif %}
{% if barcode|length > 1 or barcode == "LX008888" %}True{% else %}False{% endif %}
{% if barcode.endswith("8") %}True{% else %}False{% endif %}
Connecting the block
Add another block onto the canvas that will run if the condition is True. In the example below, an update block is added to update the barcode starting with "LX".
- Click Blocks, and drag and drop the Update block onto the canvas.
- Click Edit.
- Click Add field and select the Barcode field from the list.
- Enter a value or Jinja syntax.
- Click Save.
Launching the workflow
- Connect the blocks.
- Validate the workflow and Activate it, so that the workflow is live in your system.
- Click Run Scheduled Workflow
- Click Run Logs
.
- Your workflow should appear in the latest run log. If the logical expression used is invalid, the conditional threshold block fails with the error: Unable to execute provided logical expressions. Follow the tips and examples above to update your expression.
- When your workflow is successful, navigate to a record. In the example below, the asset records with barcodes starting with "LX" are updated as per the requirements specified in the Update block.
Documentation
Using Jinja operations in workflows
Comments
0 comments
Please sign in to leave a comment.