Intermediate6 min

Conditional Logic

Conditions let your workflow make decisions based on data. Create branches that execute different actions depending on values.

The Condition Node

The condition node evaluates an expression and creates two paths:

  • True branch - Runs when the condition is met
  • False branch - Runs when the condition is not met

Adding a Condition

  1. Add a Condition node after your trigger or action
  2. Configure the condition expression
  3. Connect nodes to both the True and False outputs

Condition Configuration

Field Selection

Choose the data field to evaluate:

  • Use the variable picker to select fields
  • Or type the path directly: trigger.fields.status

Operators

| Operator | Description | Example | |----------|-------------|---------| | equals | Exact match | status equals "active" | | not equals | Not a match | status not equals "deleted" | | contains | Substring match | email contains "@company.com" | | starts with | Prefix match | phone starts with "+1" | | ends with | Suffix match | file ends with ".pdf" | | greater than | Numeric comparison | amount greater than 100 | | less than | Numeric comparison | count less than 10 | | is empty | Null/empty check | notes is empty | | is not empty | Has value | email is not empty |

Value

Enter the value to compare against:

  • Static value: "active"
  • Variable: {{settings.threshold}}
  • Expression: {{Date.now()}}

Multiple Conditions

AND Logic

All conditions must be true:

  1. Add multiple condition rows
  2. Set the logic to AND
  3. All rows must pass for True branch

Example: User is active AND has email verified

status equals "active"
AND
emailVerified equals true

OR Logic

Any condition can be true:

  1. Add multiple condition rows
  2. Set the logic to OR
  3. Any row passing triggers True branch

Example: Priority is high OR urgent flag is set

priority equals "high"
OR
isUrgent equals true

The Switch Node

For multiple branches (more than two), use the Switch node.

Configuration

  1. Select the field to switch on
  2. Add cases for each possible value
  3. Optionally add a default case

Example: Route by Department

Switch on: trigger.fields.department

Cases:
- "sales" → Send to Sales Slack channel
- "support" → Create support ticket
- "billing" → Notify finance team
- default → Send to general inbox

Nested Conditions

Create complex logic by chaining conditions:

Condition 1: Is customer?
├── True: Condition 2: Is premium?
│   ├── True: Send priority email
│   └── False: Send standard email
└── False: Send guest notification

Common Patterns

Null Checking

Check if a value exists before using it:

Field: trigger.optionalField
Operator: is not empty

String Matching

Case-insensitive matching:

Field: {{trigger.status.toLowerCase()}}
Operator: equals
Value: "active"

Numeric Ranges

Check if a value falls in a range:

Condition 1: amount >= 100
AND
Condition 2: amount <= 500

Date Comparisons

Check if a date is in the past:

Field: {{new Date(trigger.expiresAt).getTime()}}
Operator: less than
Value: {{Date.now()}}

Best Practices

  1. Keep it simple - Avoid deeply nested conditions
  2. Use Switch for multiple values - Cleaner than many conditions
  3. Handle all cases - Always have a default/false branch
  4. Test both branches - Verify both paths work correctly
  5. Document complex logic - Add notes explaining the reasoning

Troubleshooting

Condition always True/False

  • Check your operator selection
  • Verify data types match (string vs number)
  • Test with known values

Unexpected branch taken

  • Log the actual value before the condition
  • Check for whitespace or case differences
  • Verify the data path is correct

Next Steps

Tags

workflowsconditionslogic