Skip to content

If Statement Task

Overview

The If Statement Task adds decision-making logic to workflows. It evaluates conditions and routes the workflow down different paths based on whether conditions are true or false.

When to use this task:

  • Check if a field has a value before proceeding
  • Route workflows based on contact status or tags
  • Validate data before creating records
  • Handle different scenarios (new vs existing customers)
  • Skip tasks when conditions aren't met
  • Create complex business logic flows

Key Features:

  • Multiple condition types (equals, contains, greater than, etc.)
  • AND/OR logic for complex conditions
  • Text, number, and date comparisons
  • Empty/not empty checks
  • Pattern matching and regex support
  • True/False path routing

The task has two output ports, and each child task is wired to one of them. A task connected to the wrong port simply never runs:

flowchart LR
    A[Incoming data] --> B{Condition}
    B -->|true| C[Tasks on the true port]
    B -->|false| D[Tasks on the false port]

Quick Start

Builder fields

The Field column is the label as it appears in the task builder; Key is the name the value is stored under and referenced by.

Field Key Type Default Notes
Conditions _conditions condition-builder –
  1. Add If Task to workflow
  2. Select condition type (e.g., "Equals")
  3. Enter first value: {{task_12345_status}}
  4. Enter second value: Customer
  5. Add tasks after If task
  6. Configure which tasks run when True vs False

Simple Example:

Condition: {{task_15001_contact_found}} equals true
If True: Continue to welcome email
If False: Skip welcome email

Condition Types

Equals

Tests if two values are exactly the same.

Configuration:

Value 1: {{task_15001_email}}
Condition: Equals
Value 2: john@example.com

Case Sensitivity:

  • Default: Case-insensitive (john@example.com = JOHN@EXAMPLE.COM)
  • Enable "Case Sensitive" for exact matching

Use cases:

  • Check contact status
  • Verify specific email domains
  • Match exact values

Not Equals

Tests if two values are different.

Configuration:

Value 1: {{task_15001_status}}
Condition: Not Equals
Value 2: Customer

Use cases:

  • Exclude specific values
  • Filter out unwanted data
  • Negative matching

Contains

Tests if Value 1 includes Value 2 anywhere within it.

Configuration:

Value 1: {{task_15001_tags}}
Condition: Contains
Value 2: VIP

Example matches:

Tags: "VIP, Customer, 2024" → Contains "VIP" ✓
Tags: "Very Important Person" → Contains "VIP" ✓
Tags: "Customer, Lead" → Contains "VIP" ✗

Use cases:

  • Check if tag exists in tag list
  • Search for keywords in text
  • Partial string matching

Does Not Contain

Tests if Value 1 does NOT include Value 2.

Configuration:

Value 1: {{task_55001_email}}
Condition: Does Not Contain
Value 2: @gmail.com

Use cases:

  • Exclude personal email domains
  • Filter out specific keywords
  • Negative pattern matching

Greater Than / Less Than

Compares numeric values.

Configuration:

Value 1: {{task_15001_custom_lead_score}}
Condition: Greater Than
Value 2: 75

Number formats supported:

✓ 100
✓ 99.99
✓ 1,000
✓ 1000.50

Date comparisons:

Value 1: {{task_48001_current_date}}
Condition: Greater Than
Value 2: 2024-01-01

Use cases:

  • Lead scoring thresholds
  • Age verification
  • Date range filtering
  • Quantity checks

Starts With / Ends With

Tests if text begins or ends with specific characters.

Starts With:

Value 1: {{task_55001_phone}}
Condition: Starts With
Value 2: +27

Ends With:

Value 1: {{task_55001_email}}
Condition: Ends With
Value 2: @yourcompany.com

Use cases:

  • Country code validation
  • Email domain filtering
  • Prefix/suffix matching

Is Empty / Is Not Empty

Checks if a field has any value.

Is Empty:

Value 1: {{task_15001_phone}}
Condition: Is Empty

Returns True if:

  • Field is null
  • Field is empty string ""
  • Field is whitespace only

Is Not Empty:

Value 1: {{task_15001_email}}
Condition: Is Not Empty

Use cases:

  • Data validation
  • Required field checking
  • Skip tasks if data missing

Regex Match

Tests if value matches a regular expression pattern.

Configuration:

Value 1: {{task_55001_phone}}
Condition: Matches Regex
Value 2: ^\+27[0-9]{9}$

Common patterns:

Email validation:

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Phone (SA format):

^\+27[0-9]{9}$

Postal code:

^[0-9]{4}$

URL:

^https?://.*

Use cases:

  • Advanced validation
  • Pattern extraction
  • Complex string matching

Multiple Conditions

Combine conditions with AND/OR logic.

AND Logic (All Must Be True)

Configuration:

Condition 1: {{task_15001_status}} Equals "Lead"
AND
Condition 2: {{task_15001_custom_lead_score}} Greater Than 50
AND
Condition 3: {{task_15001_tags}} Contains "Active"

Result: All three conditions must be true to proceed.

Use case: Qualify hot leads

Status = Lead AND Score > 50 AND Has "Active" tag

OR Logic (Any Can Be True)

Configuration:

Condition 1: {{task_15001_status}} Equals "Customer"
OR
Condition 2: {{task_15001_tags}} Contains "VIP"
OR
Condition 3: {{task_15001_custom_lifetime_value}} Greater Than 10000

Result: If ANY condition is true, proceed.

Use case: Identify high-value contacts

Is Customer OR Is VIP OR High Lifetime Value

Mixed AND/OR Logic

Configuration:

(Condition 1 AND Condition 2) OR Condition 3

Example:

(Status = "Lead" AND Score > 80)
OR
(Status = "Customer")

Meaning: Hot leads OR any customer.

True/False Path Routing

Path Configuration

After If Task, subsequent tasks can be configured to run conditionally:

Execution Flow:

1. If Task
2. Email Task - Set to run only if "True"
3. SMS Task - Set to run only if "False"
4. Workflow Note - Set to run "Always" (both paths)

Task Settings:

  • Run When: True / False / Always
  • Stop if False: Stop workflow vs Continue

Example Flow

1. Website Form
2. Match to Client
3. If Task: Check {{task_15_contact_found}} = true

   If TRUE:
   4a. Edit Client - Update with new data
   5a. Email - "Thanks for getting in touch again"

   If FALSE:
   4b. New Client - Create contact
   5b. Email - "Welcome to our system"

   ALWAYS (both paths):
   6. Email - Notify sales team

Stop Workflow on False

Configuration:

If Task: {{task_15001_email}} Is Not Empty
Stop Workflow if False: Yes

Result:

  • True: Continue workflow
  • False: Stop immediately, don't run subsequent tasks

Use case: Data validation gates

If email invalid → Stop
If phone empty → Stop
If under 18 years old → Stop

Outputs

Field Type Example Notes
run boolean true The decision. true means the condition passed; false means it did not.
run_text string Condition met. Which comparison was evaluated and how it resolved.

That is the whole output. The task carries no result, condition_met, value_1 or value_2 field — the branch itself is the output.

You rarely read this task's output

Children are routed by which port they are wired to, so the usual pattern is to wire tasks to the true and false ports rather than to test run downstream. Read run only when a later task needs to know which way an earlier branch went.

Real-World Examples

Treat new and returning customers differently

Form Submission
  └─ Match to Client     contact_email from the form
      └─ If Statement    run is true
          ├─ true  ─ Email   "Welcome back"
          └─ false ─ New Client   create the record

Escalate only poor reviews

Google Review Received
  └─ If Statement   {{task_63001_star_rating}} is 1, 2 or 3
      ├─ true  ─ Email   alert a person
      └─ false ─ Reply to Google Review   post a thank-you

Skip contacts who opted out

Schedule
  └─ Contact           get the contact
      └─ If Statement  {{task_28001_contact_sms_unsubscribe}} is false
          └─ SMS       send the message

Best Practices

Condition Design

  1. Be specific - Equals "Active" not Contains "Act"
  2. Handle empty values - Always check Is Not Empty first
  3. Use appropriate operators - Numeric: Greater Than, Text: Contains
  4. Test edge cases - What if field is null? Empty? Zero?

Logic Structure

  1. Validate early - Put validation If tasks at start of workflow
  2. Fail fast - Stop workflow if critical conditions fail
  3. Avoid deep nesting - Max 2-3 levels of If tasks
  4. Document complex logic - Use task notes to explain

Performance

  1. Simple conditions first - Fast checks before slow ones
  2. Minimize If tasks - Combine conditions with AND/OR
  3. Cache results - Store If results in variables if reused
  4. Avoid redundant checks - Don't check same condition twice

Maintainability

  1. Clear naming - "Check if VIP customer" not "If Task 1"
  2. Consistent values - Use same casing for comparisons
  3. Comment complex conditions - Explain business logic
  4. Group related conditions - Keep related If tasks together

Troubleshooting

Condition Always False

Check:

  1. Value format - "100" (text) ≠ 100 (number)
  2. Extra spaces - "Customer " ≠ "Customer"
  3. Case sensitivity - Enable case-insensitive if needed
  4. Empty values - Add Is Not Empty check first

Debug: View execution history to see actual values:

Value 1 evaluated as: {{task_9001_value_1}}
Value 2 evaluated as: {{task_9001_value_2}}

Wrong Path Taken

Common causes:

  1. OR vs AND confusion - Check logic operator
  2. Negation errors - "Not Equals" vs "Equals"
  3. Type mismatch - String "100" vs Number 100
  4. Null values - Null fails most comparisons

Test approach:

Add Variable task before If task:
- Store value being tested
- View in execution history
- Verify format and content

Workflow Doesn't Stop

Check:

  • "Stop Workflow if False" setting enabled?
  • Subsequent tasks set to "Always run"?
  • Is there a Loop task that continues despite failure?

Number Comparisons Not Working

Ensure:

✗ Value: "100" (text with quotes)
✓ Value: 100 (numeric)

✗ Value: R1,234.56 (with currency symbol)
✓ Value: 1234.56 (numeric only)

Solution: Use Text Formatter task to clean numbers first.

Frequently Asked Questions

Can I nest If tasks?

Yes, but keep it simple:

✓ Good: 1-2 levels
✗ Bad: 5+ levels (refactor using AND/OR)

How do I check multiple possible values?

Use OR conditions:

Status Equals "Lead" OR Status Equals "Prospect" OR Status Equals "MQL"

Or use Contains with delimited list:

"Lead,Prospect,MQL" Contains {{status}}

Can I compare two dynamic values?

Yes:

Value 1: {{task_15001_email}}
Condition: Equals
Value 2: {{task_55001_email}}

What if I need more than True/False paths?

Use multiple If tasks in sequence:

1. If: Status = "Lead" → Path A
2. Else If: Status = "Customer" → Path B
3. Else If: Status = "Partner" → Path C
4. Else: Default Path D

How do I test for null vs empty string?

Both return True for "Is Empty":

null → Is Empty = true
"" → Is Empty = true
"  " → Is Empty = true (whitespace only)

Can I use wildcards?

Not in standard conditions. Use Regex Match:

Value 1: {{task_15001_email}}
Condition: Matches Regex
Value 2: .*@yourcompany\.com$

Should I use If task or Conditional trigger filtering?

Use trigger filtering when:

  • Preventing workflow from starting
  • Filtering at source (more efficient)

Use If task when:

  • Logic depends on multiple tasks' results
  • Need different actions for True/False
  • Validating data mid-workflow

  • Loop Task - Iterate with conditional logic
  • Variable Task - Store condition results
  • Code Task - Complex custom logic
  • Match to Client - Conditional contact matching
  • Webhook Out - Conditional API calls