Loopfour
Blocks

Condition Block

Branch workflow execution paths based on boolean expressions

The Condition block evaluates a boolean expression and routes execution to one of two paths: true or false. Use it to branch workflows based on data values, thresholds, or the presence of specific fields.

Configuration

Expression

A JavaScript expression that evaluates to true or false. The expression has access to data from upstream blocks via template variables.

Examples:

// Amount threshold
{{input.data.object.amount_paid}} > 100000

// String comparison
{{steps.lookup.output.status}} === "active"

// Field existence
{{input.data.object.customer_email}} !== null

// Compound conditions
{{input.amount}} > 5000 && {{input.currency}} === "usd"

True Path / False Path

Each path connects to different downstream blocks. When the expression evaluates to true, only the true-path blocks execute. When false, only the false-path blocks execute.

Common Patterns

High-Value Invoice Approval

Stripe (invoice created) -> Condition (amount > $5,000?)
    -> True: Approval (manager review) -> QuickBooks (create invoice)
    -> False: QuickBooks (create invoice)

Customer Tier Routing

Webhook -> Condition (customer.plan === "enterprise"?)
    -> True: Slack (#enterprise-support)
    -> False: Email (standard notification)

Error Handling

Stripe (create charge) -> Condition (status === "succeeded"?)
    -> True: QuickBooks (record payment)
    -> False: Slack (alert finance) + Gmail (notify customer)

Outputs

The Condition block passes through the upstream data unchanged. It does not transform data -- it only controls which path executes.

OutputTypeDescription
resultbooleanThe evaluation result (true or false)

Best Practices

  • Keep expressions simple. For complex logic, use a Code block upstream to compute a boolean value, then use the Condition block to branch on it.

  • Handle both paths. Always define behavior for both true and false outcomes to avoid silent failures.

  • Use descriptive names. Name your condition blocks after the decision: "Amount over $5K?" is clearer than "Condition 1."

Frequently Asked Questions

The Condition block evaluates JavaScript expressions. You can use comparison operators (===, !==, >, <, >=, <=), logical operators (&&, ||, !), and template variables to reference data from upstream blocks. The expression must evaluate to a boolean value.

Yes. You can chain Condition blocks by connecting one Condition's output to another Condition's input. This creates nested decision trees for complex routing logic.

If the expression cannot be evaluated (for example, referencing a field that does not exist), the block follows the workflow's error handling strategy -- either failing the workflow, continuing with a null result, or retrying.

Yes. If your routing logic requires natural language understanding or complex reasoning, use an Agent block with a classification prompt instead of a Condition block. The Agent can output a structured result that a downstream Condition block can branch on.

On this page