<!-- BusyBot node reference — https://busybot.net/tools/if/ -->

> Node: If (`if`) · Action · v1
> Category: Core Nodes · Credentials: none
> Updated: 2026-08-16

# 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

| 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:

```json
{
  "_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:

```json
{
  "type": "if",
  "parameters": {
    "conditions": {
      "rules": [
        {
          "leftValue": "{{ $json.status }}",
          "operation": "equals",
          "rightValue": "active"
        }
      ]
    }
  }
}
```

Require both a numeric range and a country match:

```json
{
  "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:

```json
{
  "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:

```json
{
  "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).