Reference · Tools

If

Routes items to TRUE or FALSE

Action Core Nodes v1

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.

Node type
Action
Parameters
9
Outputs
True, False, Error
Credentials
None required

If

Route items based on condition

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 }}.

Category: Core Nodes
Tool Name: if
Version: 1

Appearance: Icon: split | Color: #f59e0b

Node Type

Action — processes input items and produces output

Input / Output

DirectionPort(s)
InputInput
OutputTrue, False, Error

Credentials

This tool does not require any credentials.

Parameters

ParameterTypeRequiredDefaultDescription
Combine RulesoptionsNoallHow multiple rules are combined to determine the final result.
Options: all (every rule must pass), any (one passing rule is enough)
NegatebooleanNofalseIf true, the final result is inverted (TRUE becomes FALSE, and vice-versa).
RulesfixedCollectionNo{ rules: [] }Define one or more rules. Each rule can use expressions like {{ $json.field }} in Left/Right values.
— Left ValuestringNo{{ $json.value }}Left-hand side. Often an expression like {{ $json.someField }}.
— OperationoptionsNoequalsComparison 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 ValuestringNoRight-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 ModeoptionsNoautoHow to interpret values for equals and numeric comparisons. Auto will try boolean/number/date before string.
Options: auto, string, number, boolean, date
Case SensitivebooleanNofalseIf false, string comparisons are case-insensitive (contains/equals/etc).
Regex FlagsstringNoFlags for regex operations (e.g. ‘i’, ‘gm’). Only used when Operation = Regex Match.
No Rules BehavioroptionsNotrueWhat to do if no rules are configured.
Options: true (route everything to TRUE), false (route everything to FALSE)
Include Evaluation MetadatabooleanNofalseIf true, adds an _if object to the output item’s json with evaluation details (rule results, combine mode, etc).
Max ConcurrencynumberNo100Maximum 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
      }
    ]
  }
}
  • leftValue and rightValue are what you configured; leftResolved and rightResolved are the values after expressions were evaluated — the fastest way to see why a rule did not match.
  • passed on the _if object is the final verdict, after Combine Rules and Negate. It matches the branch the item took.
  • rules is empty when the node has no rules configured.
  • With error handling set to continue (the default), an item that fails evaluation is routed to False carrying an _error object, so check for it before treating that branch as a plain negative result.

Reference the metadata downstream by expression, e.g. {{ $json._if.passed }}.

Usage Examples

  • 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

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

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes 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 BusyBot

Last updated . Spotted something wrong? Tell us.