Reference · Tools
If node
Routes items to one of two outputs based on whether a specified condition is true or false.
The If node splits a workflow in two, evaluating a condition and sending items to the True branch or the False branch so each case gets its own handling. It needs no credentials. A typical build is checking an order total and routing high-value orders to a manual review path while the rest continue automatically.
- Works as
- Action
- Tool name
if- Parameters
- 9
- Outputs
- True, False, Error
- Credentials
- None required
What you can build with If
- If status equals active then process.
- Route based on user type.
- Check if amount is greater than threshold.
- Branch depending on response code.
- Split items by category.
Overview
Routes items to the TRUE (port 0) or FALSE (port 1) output based on one or more comparison rules. Supports expressions like {{ $json.field }}.
Node Type
Action — processes input items and produces output
Input / Output
| Direction | Port(s) |
|---|---|
| Input | Input |
| Output | True, False, Error |
Credentials
This tool does not require any credentials.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| Combine Rules | options | No | all | How multiple rules are combined to determine the final result. |
Options: all (every rule must pass), any (one passing rule is enough) | ||||
| Negate | boolean | No | false | If true, the final result is inverted (TRUE becomes FALSE, and vice-versa). |
| Rules | fixedCollection | No | { rules: [] } | Define one or more rules. Each rule can use expressions like {{ $json.field }} in Left/Right values. |
| — Left Value | string | No | {{ $json.value }} | Left-hand side. Often an expression like {{ $json.someField }}. |
| — Operation | options | No | equals | Comparison operator. |
Options: equals, not_equals, contains, not_contains, starts_with, ends_with, gt, gte, lt, lte, exists, not_exists, is_empty, is_not_empty, is_true, is_false, in, not_in, regex | ||||
| — Right Value | string | No | — | Right-hand side (if applicable). For ‘In List’, use comma-separated values or a JSON array string. (hidden when Operation is exists, not_exists, is_empty, is_not_empty, is_true, is_false) |
| Comparison Mode | options | No | auto | How to interpret values for equals and numeric comparisons. Auto will try boolean/number/date before string. |
Options: auto, string, number, boolean, date | ||||
| Case Sensitive | boolean | No | false | If false, string comparisons are case-insensitive (contains/equals/etc). |
| Regex Flags | string | No | — | Flags for regex operations (e.g. ‘i’, ‘gm’). Only used when Operation = Regex Match. |
| No Rules Behavior | options | No | true | What to do if no rules are configured. |
Options: true (route everything to TRUE), false (route everything to FALSE) | ||||
| Include Evaluation Metadata | boolean | No | false | If true, adds an _if object to the output item’s json with evaluation details (rule results, combine mode, etc). |
| Max Concurrency | number | No | 100 | Maximum number of items to evaluate concurrently. |
Output Data
Every input item leaves through exactly one branch — True or False — and no items are lost. The item JSON passes through unchanged and binary data is forwarded; the node only adds a property when Include Evaluation Metadata is on.
- Each rule resolves its Left Value and Right Value first, so both sides can be expressions.
- Combine Rules decides the verdict for the item, then Negate flips it if set.
- When no rules are configured, No Rules Behavior decides the branch for every item.
With Include Evaluation Metadata on, each output item carries:
{
"_if": {
"passed": true,
"combine": "all",
"negate": false,
"comparisonMode": "auto",
"caseSensitive": false,
"evaluatedAt": 1765432100000,
"rules": [
{
"index": 0,
"leftValue": "{{ $json.status }}",
"operation": "equals",
"rightValue": "active",
"leftResolved": "active",
"rightResolved": "active",
"passed": true
}
]
}
}
leftValueandrightValueare what you configured;leftResolvedandrightResolvedare the values after expressions were evaluated — the fastest way to see why a rule did not match.passedon the_ifobject is the final verdict, after Combine Rules and Negate. It matches the branch the item took.rulesis empty when the node has no rules configured.- With error handling set to continue (the default), an item that fails evaluation is routed to
Falsecarrying an_errorobject, so check for it before treating that branch as a plain negative result.
Reference the metadata downstream by expression, e.g. {{ $json._if.passed }}.
Example Configuration
Send active records down the True branch:
{
"type": "if",
"parameters": {
"conditions": {
"rules": [
{
"leftValue": "{{ $json.status }}",
"operation": "equals",
"rightValue": "active"
}
]
}
}
}
Require both a numeric range and a country match:
{
"type": "if",
"parameters": {
"combine": "all",
"comparisonMode": "number",
"conditions": {
"rules": [
{
"leftValue": "{{ $json.age }}",
"operation": "gte",
"rightValue": "18"
},
{
"leftValue": "{{ $json.score }}",
"operation": "lte",
"rightValue": "100"
}
]
}
}
}
Check that the required fields are populated before continuing:
{
"type": "if",
"parameters": {
"combine": "all",
"includeEvaluation": true,
"conditions": {
"rules": [
{
"leftValue": "{{ $json.email }}",
"operation": "is_not_empty"
},
{
"leftValue": "{{ $json.phone }}",
"operation": "is_not_empty"
}
]
}
}
}
Match a pattern case-insensitively, or check membership of a short list:
{
"type": "if",
"parameters": {
"combine": "any",
"caseSensitive": false,
"regexFlags": "i",
"conditions": {
"rules": [
{
"leftValue": "{{ $json.email }}",
"operation": "regex",
"rightValue": "@example\\.com$"
},
{
"leftValue": "{{ $json.region }}",
"operation": "in",
"rightValue": "us-east, us-west"
}
]
}
}
}
Error Handling
| Mode | Behavior |
|---|---|
| stop | Halts workflow on first error |
| continue | Skips failed items, passes successful ones through |
| errorPort | Routes failed items to Error output port |
Tips
Evaluates a condition and routes all items to one of two output branches: true or false. Use when execution needs to split based on a data condition and different downstream tools should handle each case. Produces all input items on the matching branch output (index 0 for true, index 1 for false).
Frequently asked questions
Which output is which?
Output index 0 is True and index 1 is False, with an error output after them. Wiring the wrong branch is the most common mistake — check the port labels rather than the order they appear on screen.
Does it drop items that fail the condition?
No. Every input item comes out somewhere: matching items on True, the rest on False. Use Filter if you want non-matching items discarded instead.
How is this different from Switch?
If has two branches. Switch supports up to ten outputs plus a fallback, so use If for a yes/no decision and Switch when you are routing into several categories.
Does it need credentials?
No — it evaluates data already in the workflow.
Build with the If node
Drop it into a workflow, wire it to an agent, or call it on a schedule.
Open BusyBotLast reviewed . Spotted something wrong? Tell us.