Condition block
Configure the Condition block: write the expression it evaluates and connect the branches the workflow follows when it is true or false.
The Condition block (type: "condition") tests values from the run and sends it down one of two branches: then when the test is true, else when it is false. For the plain-language guide, see Make a decision.
When to use it
- Route a bill over an approval limit to an Approval step.
- Skip a step when an earlier lookup found nothing, for example create a customer only when the search returned no match.
- Stop on an error path: point
elseat a step withterminal: true.
Configuration
In the editor you build the test as rows in Conditions and join them with Combine With (AND or OR). The branches are the connections you draw from the block. On save, the editor writes this config:
Field (config key) | Type | Required | Meaning |
|---|---|---|---|
conditions | expression | Yes | The test. See the expression forms below. |
then | string array | Yes | Ids of the steps to run when the test is true. At least one. |
else | string array | No | Ids of the steps to run when the test is false. |
Expression forms
| Form | Shape |
|---|---|
| Comparison | { "left": "<value>", "operator": "<operator>", "right": "<value>" } |
| Group | { "operator": "and", "conditions": [ ... ] } or "or" |
| Negation | { "not": <expression> } |
left and right are strings. Each can be a literal or a template reference such as {{steps.extract_bill.structured.total}}, resolved before the comparison.
Operators
| Operator | True when |
|---|---|
eq | Values are equal. Numeric text compares as numbers, so "10.00" equals "10". |
ne | Values are not equal. |
gt, gte, lt, lte | Numeric comparison. $, €, £, ¥ and commas are removed first; text that is not a number counts as 0. |
contains, startsWith, endsWith | Text comparison. Objects and arrays are compared as JSON text. |
exists | left is not null or missing. right is not used. |
isEmpty | left is missing, null, blank text, an empty array or an empty object. right is not used. |
matches | left matches the regular expression in right. An invalid pattern is false. |
How branches run
Top-level steps run in array order. Steps listed in then or else run from the condition. The branch not taken is marked skipped, together with any steps nested inside it. A step listed in both branches, or reached again from another branch, runs when a taken path reaches it.
Output
| Field | Type | Meaning |
|---|---|---|
result | boolean | The test result. |
branch | string | then or else. |
nextSteps | string array | The step ids the taken branch ran. |
branchResults | array | The output of each step in the taken branch, in order. |
Read the result as {{steps.<step id>.result}}.
Example
This workflow creates a QuickBooks bill and asks the controller to approve bills of $10,000 or more first.
{
"name": "Approve large bills",
"trigger": { "type": "api" },
"steps": [
{
"id": "check_amount",
"type": "condition",
"name": "Bill is $10,000 or more?",
"config": {
"conditions": { "left": "{{input.amount}}", "operator": "gte", "right": "10000" },
"then": ["controller_approval"]
}
},
{
"id": "controller_approval",
"type": "approval",
"name": "Controller approves bill",
"config": {
"approvers": ["controller@example.com"],
"reason": "Bill {{input.billNumber}} from {{input.vendorName}} for {{input.amount}}",
"timeout": "3d",
"notifyChannels": [
{ "type": "email", "instructions": "Write a short note asking the controller to approve this vendor bill." }
]
}
},
{
"id": "create_bill",
"type": "action",
"name": "Create bill in QuickBooks",
"action": "quickbooks.createBill",
"config": {
"vendorId": "{{input.vendorId}}",
"billNumber": "{{input.billNumber}}",
"lines": "{{input.lines}}"
}
}
]
}Bills under $10,000 skip the approval and go straight to create_bill. A rejected approval fails the run, so the bill is not created.
Errors and limits
- A config without
conditionsor with an emptythenfails the step withInvalid condition step config. - A reference that resolves to nothing compares as empty:
existsis false, andgtagainst it treats it as 0. Test withexistsfirst when a field can be missing. - In the editor, a condition with no rows saves as a comparison of two empty values, which is true.
Loopfour