Condition Steps
Branch workflows based on conditional logic
Condition Steps
Condition steps enable branching logic in workflows, allowing you to execute different paths based on data values, comparisons, and complex boolean expressions.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique step identifier |
type | string | Yes | Must be "condition" |
name | string | Yes | Human-readable name |
config.conditions | object | Yes | Condition expression to evaluate |
config.then | string[] | Yes | Step IDs to execute if true |
config.else | string[] | No | Step IDs to execute if false |
Simple Conditions
A simple condition compares two values using an operator:
| Field | Description |
|---|---|
left | Left operand (template expression or literal) |
operator | Comparison operator |
right | Right operand (optional for some operators) |
Comparison Operators
| Operator | Description | Example |
|---|---|---|
eq | Equal to | "status" eq "active" |
ne | Not equal to | "type" ne "draft" |
gt | Greater than | "amount" gt "1000" |
gte | Greater than or equal | "count" gte "10" |
lt | Less than | "priority" lt "5" |
lte | Less than or equal | "score" lte "100" |
contains | String contains substring | "email" contains "@company.com" |
startsWith | String starts with | "id" startsWith "cus_" |
endsWith | String ends with | "filename" endsWith ".pdf" |
exists | Value exists (not null/undefined) | "customer_id" exists |
isEmpty | Value is empty | "notes" isEmpty |
matches | Regex pattern match | "phone" matches "^\+1" |
Operator Examples
Numeric Comparison:
String Comparison:
Existence Check:
Regex Match:
Compound Conditions
AND Conditions
All conditions must be true:
OR Conditions
At least one condition must be true:
NOT Conditions
Negate a condition:
Nested Conditions
Combine AND, OR, and NOT for complex logic:
Branching Patterns
If/Else
Basic two-way branching:
Multiple Then Steps
Execute multiple steps when condition is true:
Chained Conditions (If/Else If/Else)
Use multiple condition steps for switch-like logic:
Guard Conditions
Exit early if a condition isn't met:
An empty else: [] means the workflow ends without error if the condition is false.
Using Step Outputs
Reference previous step outputs in conditions:
Common Patterns
Approval Routing
Route based on amount thresholds:
Feature Flags
Check for optional features:
Error Recovery
Check if a previous step succeeded:
Data Validation
Validate required fields before processing:
Troubleshooting
Condition Always False
- Check template syntax - Ensure
{{}}wrapping is correct - Verify data types - Numbers should be compared as numbers
- Check for null values - Use
existsoperator first - Debug with transform - Add a transform step to log values
Type Coercion
Values are compared as strings by default. For numeric comparisons, ensure both operands are numeric:
Missing Branches
If neither then nor else matches, the workflow continues to the next sequential step.