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

  1. In the Flow editor, click Add Step
  2. Select Conditional Logic
  3. 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:

{{sentiment.score}} > 0.5

Supported operators:

  • ==, !=, <, >, <=, >= — Comparison
  • &&, || — Logical AND/OR
  • ! — Negation

Examples

Check AI confidence

{{analysis_result.confidence}} > 0.8

If true: Use AI response. Else: Route to human review.

User tier routing

{{customer_data.tier}} == "premium"

If true: Priority support Flow. Else: Standard support Flow.

Error detection

{{api_result.status}} != 200

If true: Error handling. Else: Process response.

Multiple conditions

{{order_total}} > 1000 && {{customer_data.tier}} == "standard"

If true: Require approval. Else: Auto-approve.

String comparisons

Use quotes for string values:

{{sentiment_result.label}} == "negative"
{{process_status}} != "completed"

Checking for existence

Test if a value exists:

{{customer_data.email}} != null
{{order_history.length}} > 0

Nested conditionals

Add conditional steps inside if/else branches for complex logic:

Main conditional: Is tier premium?
If true:
Nested conditional: Is order > $5000?
If true: VIP processing
Else: Premium processing
Else: Standard processing

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:

Conditional: Is request invalid?
If true: Log or notify about the error
Else: Continue processing

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:

{{branch_result}}

Testing conditionals

Run your Flow with inputs that trigger both branches:

  1. Test with condition = true input
  2. Verify “if” branch executes
  3. Test with condition = false input
  4. Verify “else” branch executes

Common patterns

Validation

Conditional: Input is valid?
If false: Log validation error
Else: Continue processing

Feature flags

Conditional: New feature enabled?
If true: New implementation
Else: Legacy implementation

Fallback logic

Conditional: Primary API succeeded?
If false: Try backup API
Else: Use primary response

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:

  1. In the Flow editor, find the step you want to gate
  2. Click the Always run pill on that step
  3. Enter a JavaScript expression in the condition editor (up to 500 characters)
  4. 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 outputVariable is set to null, so later steps that reference it see null rather 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:

{{needs_retry}} == true

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.

when conditionConditional step
ScopeGates a single stepGates one or more branching steps
BranchesSkip or runTrue branch and false branch
Output when skippedoutputVariable becomes nullBranch steps set their own outputs
Use case”Only run this step if X""If X do A, else do B”

Next steps