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

[SCREENSHOT NEEDED: If Statement task configuration panel showing condition builder]

Quick Start

  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.

[SCREENSHOT NEEDED: Condition builder showing multiple conditions with AND/OR operators]

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. MySQL Task - 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

Output Fields

Field Description Example Value
task_[ID]_result Condition result true / false
task_[ID]_condition_met Same as result true / false
task_[ID]_value_1 First value evaluated john@example.com
task_[ID]_value_2 Second value evaluated @gmail.com
task_[ID]_condition_type Type of condition used contains, equals, etc.

Usage:

{{task_9001_result}} → true or false
{{task_9001_condition_met}} → true or false

Real-World Examples

Example 1: New vs Existing Customer

Workflow: 1. Website Form 2. Match to Client 3. If Task - Check if contact was found

Condition:

{{task_15001_contact_found}} Equals true

If TRUE (Existing Customer): 4. Edit Client - Update contact data 5. Email - "Thanks for reaching out again!"

If FALSE (New Customer): 6. Edit Client - Add "First Contact" tag 7. Email - "Welcome! Here's what to expect..."

Example 2: Lead Scoring

Workflow: 1. CRM Trigger - Custom field changed 2. If Task - Check lead score

Condition:

{{task_47001_custom_lead_score}} Greater Than 80

If TRUE (Hot Lead): 3. Edit Client - Add "Hot Lead" tag 4. Email - Notify sales manager immediately 5. Webhook Out - Send Slack alert

If FALSE (Normal Lead): 6. Edit Client - Add to nurture sequence tag 7. Delay - Wait 2 days 8. Email - Send standard follow-up

Example 3: Email Domain Validation

Workflow: 1. Website Form 2. If Task - Check if business email

Condition:

{{task_55001_email}} Does Not Contain @gmail.com
AND
{{task_55001_email}} Does Not Contain @yahoo.com
AND
{{task_55001_email}} Does Not Contain @outlook.com

If TRUE (Business Email): 3. Match to Client - Find existing qualified lead 4. Edit Client - Add "B2B Lead" tag 5. Email - Send business-focused content

If FALSE (Personal Email): 6. Match to Client - Find existing consumer lead 7. Edit Client - Add "B2C Lead" tag 8. Email - Send consumer-focused content

Example 4: Data Validation Gate

Workflow: 1. Webhook In - API integration 2. If Task - Validate required fields

Condition:

{{task_46001_email}} Is Not Empty
AND
{{task_46001_phone}} Is Not Empty
AND
{{task_46001_first_name}} Is Not Empty

Stop Workflow if False: Yes

If TRUE (Valid Data): 3. Match to Client - Process normally 4. Email - Send confirmation

If FALSE (Invalid Data): - Workflow stops - Error logged - Admin notified via separate error workflow

Example 5: VIP Customer Special Treatment

Workflow: 1. Call Connect Trigger - Incoming call 2. Match to Client - Find contact by phone 3. If Task - Check VIP status

Condition:

{{task_15001_tags}} Contains VIP
OR
{{task_15001_custom_lifetime_value}} Greater Than 50000
OR
{{task_15001_status}} Equals Premium Member

If TRUE (VIP Customer): 4. Webhook Out - Route call to senior team 5. Email - Alert account manager 6. Edit Client - Log VIP call

If FALSE (Regular Customer): 7. Webhook Out - Route call to standard queue 8. Edit Client - Log standard call

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