IfCondition if-condition
Evaluate a boolean expression and route workflow execution to the true or false output port. The foundational branching primitive for all conditional logic in a workflow.
When to Use
- Route orders by total: Send orders over $100 to a premium fulfilment path and smaller orders to standard processing using
{{ $json.orderTotal > 100 }}. - Access control gate: Check whether the authenticated user holds a required role —
{{ $json.userRole === "admin" }}— before exposing admin-only operations downstream. - API response branching: After an HttpRequest node, evaluate
{{ $output.callApi.statusCode === 200 }}to take the success path or route errors to a notification node. - Email format guard: Validate an address with a regex expression before routing to a SendEmail node, avoiding bounce errors from malformed inputs.
- Skip already-completed records: Check
{{ $json.status !== "complete" }}so already-processed records are bypassed and not re-processed in scheduled batch workflows.
Configuration
| Field | Required | Description |
|---|---|---|
Condition |
Required | A JavaScript-style expression that evaluates to true or false. Supports comparisons (===, !==, >, <, >=, <=), logical operators (&&, ||, !), ternary, and string/array methods. Template variables ({{ }}) are resolved before evaluation. |
Condition field is first resolved as a template expression (all {{ }} substitutions applied), then the resulting string is evaluated as a boolean. An expression resolving to "true", "1", or any truthy value routes to the true port.
Output Ports
| Port | Fires When |
|---|---|
true | The condition expression evaluates to a truthy value. Downstream nodes on this branch execute next. |
false | The condition expression evaluates to a falsy value: false, 0, null, undefined, or empty string. Route non-matching items here for alternative handling or a StopWorkflow node. |
error | The condition expression itself throws a runtime error — e.g. accessing a property on null, a syntax error in the expression, or an unresolvable template variable. Treat this port as an exception path and always connect it. |
OutputData Fields
The following fields are written to ExecutionMemory on execution and accessible downstream via $output.<nodeKey>:
| Field | Type | Description |
|---|---|---|
ConditionResult | boolean | The evaluated boolean result of the condition. Available on both the true and false ports so downstream nodes can always read the original result without re-evaluating. |
Sample Configuration
Simple value comparison
{
"Condition": "{{ $json.orderTotal > 100 }}"
}
Role check
{
"Condition": "{{ $json.userRole === 'admin' }}"
}
API status code check
{
"Condition": "{{ $output.callApi.statusCode === 200 }}"
}
Compound condition
{
"Condition": "{{ $json.isVerified === true && $json.subscriptionStatus === 'active' }}"
}
Sample Output
True Port
When the condition evaluates to true, the input data passes through unchanged to the true port.
{
"orderId": "ORD-2025-00891",
"customerId": "cust_gold_007",
"orderTotal": 1850.00,
"currency": "USD",
"tier": "gold",
"_condition": {
"evaluated": true,
"expression": "{{ $json.orderTotal > 1000 && $json.tier === 'gold' }}",
"result": true
}
}
False Port
When the condition evaluates to false, the same input data routes to the false port.
{
"orderId": "ORD-2025-00892",
"customerId": "cust_std_012",
"orderTotal": 350.00,
"currency": "USD",
"tier": "standard",
"_condition": {
"evaluated": true,
"expression": "{{ $json.orderTotal > 1000 && $json.tier === 'gold' }}",
"result": false
}
}
Expression Reference
Access this node's output in downstream nodes using the node's key:
| Expression | Returns |
|---|---|
{{ $output.checkOrderValue.ConditionResult }} | true or false |
Variables available inside the Condition expression:
| Expression | Description |
|---|---|
{{ $json.fieldName }} | Field from the current trigger payload or the most recent node's JSON output. |
{{ $output.nodeKey.fieldName }} | Specific field from a named upstream node's output. |
{{ $var.variableName }} | Variable stored in ExecutionMemory by a VariableAssignment node. |
{{ $now }} | Current UTC timestamp as ISO 8601 string. |
Validation Errors
| Error | Cause |
|---|---|
VAL_MISSING_CONDITION | The Condition field is empty or whitespace. |
Node Policies and GuardRails
- No side effects in the condition: The Condition expression must be a pure evaluation. Do not call APIs, write to databases, or mutate variables inside the expression. Side-effect work belongs in dedicated execution nodes before or after the IfCondition.
- Keep conditions readable: If a condition requires 3 or more
&&/||clauses, consider pre-computing a boolean with a VariableAssignment node and referencing it here as{{ $var.meetsEligibility }}. - Use Switch for 3+ branches: If you need to route to three or more paths based on a single value, use the Switch node. Chained IfCondition nodes create deeply nested workflow graphs that are hard to maintain.
- Always wire the false port: Connect the
falseport to a StopWorkflow, logging, or notification node. An unwired false port silently drops execution and can mask logic errors in production. - Always wire the error port: Connect the
errorport to a CatchBlock or error-notification node. Expression errors are a real failure mode when input data shape varies. - Use strict equality: Use
===rather than==to avoid unexpected JavaScript type coercions."1" == 1istrue, which can cause surprising routing.
{{ $json.user?.role === 'admin' }} instead of {{ $json.user.role === 'admin' }}. The latter throws on the error port when user is null.
Pattern Examples
Pattern 1 — Guard Clause at Workflow Entry
Place an IfCondition immediately after a trigger to reject irrelevant events before any expensive processing begins. Non-matching items exit silently via StopWorkflow, keeping the happy path clean.
WebhookTrigger
└─► IfCondition [key: "guardEventType"]
Condition: {{ $json.eventType === 'order.created' }}
├─► true ──► [proceed with order processing]
└─► false ──► StopWorkflow (ignore irrelevant webhook events)
Pattern 2 — Role-Based Feature Gate
Check the current user's role before executing privileged operations. The false branch returns an authorization error rather than proceeding.
FormTrigger
└─► IfCondition [key: "checkAdminRole"]
Condition: {{ $json.userRole === 'admin' }}
├─► true ──► [perform admin operation]
└─► false ──► HttpRequest (POST /api/audit/unauthorized-attempt)
└─► StopWorkflow
Pattern 3 — API Response Validation
After calling an external API, validate the response before consuming its data. Unexpected status codes route to alerting without crashing the workflow.
HttpRequest [key: "callPaymentApi"]
└─► IfCondition [key: "checkPaymentStatus"]
Condition: {{ $output.callPaymentApi.statusCode === 200 }}
├─► true ──► VariableAssignment (store confirmation)
│ └─► [continue order fulfilment]
└─► false ──► EmailSmtp (alert ops team of payment API failure)
└─► StopWorkflow