Using conditional steps
Conditional steps branch Flow execution based on conditions, letting you build if/else logic and route data through different paths. To gate a single step instead of branching, give that step a when condition — see Conditionally skipping a single step (when).
Add a conditional step
- In the Flow editor, click Add Step
- Select Conditional Logic
- Configure:
- Condition: the expression that decides which branch runs
- If true: steps to run when the condition is true
- Otherwise: steps to run when the condition is false (optional)
Changes save with the Flow; there is no separate save-step button. Rename the step inline in its header.
Writing conditions
Conditions use JavaScript expressions. Reference variables with {{variable}} syntax:
Supported operators:
==,!=,<,>,<=,>=— Comparison&&,||— Logical AND/OR!— Negation
Examples
Check AI confidence
If true: Use AI response. Else: Route to human review.
User tier routing
If true: Priority support Flow. Else: Standard support Flow.
Error detection
If true: Error handling. Else: Process response.
Multiple conditions
If true: Require approval. Else: Auto-approve.
String comparisons
Use quotes for string values:
Checking for existence
Test if a value exists:
Nested conditionals
Add conditional steps inside if/else branches for complex logic:
Conditional steps can be nested up to 10 levels deep. Flows that exceed this limit fail validation. Real-world flows rarely need more than 3 or 4 levels. If you are approaching the limit, use a transform-data step to consolidate the branching logic into a single boolean expression, then reference that in one conditional.
Stopping on invalid input
Use a conditional branch to guard against invalid requests. Place the main processing logic in the “else” branch so the Flow skips it when validation fails:
Keep conditions simple. If you need complex logic, use a transform-data step to calculate a boolean, then reference that in the conditional.
Accessing branch outputs
Steps inside conditional branches set their outputVariable in the same Flow-level scope. Reference them by their outputVariable name in later steps:
Testing conditionals
Run your Flow with inputs that trigger both branches:
- Test with condition = true input
- Verify “if” branch executes
- Test with condition = false input
- Verify “else” branch executes
Common patterns
Validation
Feature flags
Fallback logic
Conditionally skipping a single step (when)
Any step can carry an optional when condition that gates just that one step. When the condition is falsy, the step is skipped and the Flow continues — you don’t need to wrap the step in a Conditional to do this.
This is useful when one step should only run in certain cases, such as a retry that runs only after a failure, or an enrichment step that runs only when data is present.
Set a when condition in the editor
By default, every step shows an Always run pill. Set a condition to make the step run only when that condition is true:
- In the Flow editor, find the step you want to gate
- Click the Always run pill on that step
- Enter a JavaScript expression in the condition editor (up to 500 characters)
- Save the condition
Once a condition is set, the pill changes to Runs conditionally with an amber accent, and the step gets an amber left border so you can spot gated steps at a glance. Consecutive steps that share the same condition are grouped together under a single amber border.
How skipping works
When the Flow runs and a step’s when condition evaluates to a falsy value, that step is skipped:
- The step’s
outputVariableis set tonull, so later steps that reference it seenullrather than stale data - The Flow continues to the next step as normal
- The step appears as skipped in the execution trace
Conditions use the same {{variable}} syntax as Conditional steps. For example:
This step runs only when needs_retry is true; otherwise it is skipped.
Errors are treated as skip by default
If a when condition throws an error — for example, because of a typo or a missing variable — the step is skipped by default rather than failing the whole Flow. This keeps a single bad expression from halting execution.
If you want a broken condition to stop the Flow instead, set the step’s error handling to fail on error.
When to use when vs a Conditional step
Use when to skip a single step. Use a Conditional step when you need separate true and false branches.
Next steps
- Flow variables and templates for variable reference
- Using transform-data steps to prepare data for conditionals
- Debugging flows to trace conditional execution and skipped steps