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¶
- Add If Task to workflow
- Select condition type (e.g., "Equals")
- Enter first value:
{{task_12345_status}} - Enter second value:
Customer - Add tasks after If task
- 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:
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:
Use cases: - Exclude specific values - Filter out unwanted data - Negative matching
Contains¶
Tests if Value 1 includes Value 2 anywhere within it.
Configuration:
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:
Use cases: - Exclude personal email domains - Filter out specific keywords - Negative pattern matching
Greater Than / Less Than¶
Compares numeric values.
Configuration:
Number formats supported:
Date comparisons:
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:
Ends With:
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:
Returns True if: - Field is null - Field is empty string "" - Field is whitespace only
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:
Common patterns:
Email validation:
Phone (SA format):
Postal code:
URL:
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
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
Mixed AND/OR Logic¶
Configuration:
Example:
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:
Result: - True: Continue workflow - False: Stop immediately, don't run subsequent tasks
Use case: Data validation gates
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:
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:
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:
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¶
- Be specific -
Equals "Active"notContains "Act" - Handle empty values - Always check
Is Not Emptyfirst - Use appropriate operators - Numeric: Greater Than, Text: Contains
- Test edge cases - What if field is null? Empty? Zero?
Logic Structure¶
- Validate early - Put validation If tasks at start of workflow
- Fail fast - Stop workflow if critical conditions fail
- Avoid deep nesting - Max 2-3 levels of If tasks
- Document complex logic - Use task notes to explain
Performance¶
- Simple conditions first - Fast checks before slow ones
- Minimize If tasks - Combine conditions with AND/OR
- Cache results - Store If results in variables if reused
- Avoid redundant checks - Don't check same condition twice
Maintainability¶
- Clear naming - "Check if VIP customer" not "If Task 1"
- Consistent values - Use same casing for comparisons
- Comment complex conditions - Explain business logic
- Group related conditions - Keep related If tasks together
Troubleshooting¶
Condition Always False¶
Check:
- Value format -
"100"(text) ≠100(number) - Extra spaces -
"Customer "≠"Customer" - Case sensitivity - Enable case-insensitive if needed
- Empty values - Add
Is Not Emptycheck first
Debug: View execution history to see actual values:
Wrong Path Taken¶
Common causes:
- OR vs AND confusion - Check logic operator
- Negation errors - "Not Equals" vs "Equals"
- Type mismatch - String "100" vs Number 100
- 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:
How do I check multiple possible values?¶
Use OR conditions:
Or use Contains with delimited list:
Can I compare two dynamic values?¶
Yes:
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":
Can I use wildcards?¶
Not in standard conditions. Use Regex Match:
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
Related Tasks¶
- 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