Conditional Logic
Control workflow execution with conditions and filters.
Overview
Conditional logic allows you to control which actions execute based on data from triggers or previous actions. This enables you to create smart workflows that respond differently to different situations.
How Conditions Work
Conditions evaluate data and determine whether to:
- Execute an action (condition is true)
- Skip an action (condition is false)
Setting Up Conditions
On Triggers
Filter when the workflow runs:
- Configure your trigger
- Set filter conditions
- Workflow only fires when conditions are met
Example: Post Published Trigger
Filter: Post Type = "post"
Filter: Category = "Blog"
On Actions
Control whether an action executes:
- Select an action
- Click the Condition icon
- Configure the condition
- Action only runs when true
Condition Operators
| Operator | Description | Example |
|---|---|---|
equals | Exact match | Status equals “completed” |
not equals | Does not match | Role not equals “admin” |
contains | Text includes | Email contains “@gmail” |
not contains | Text excludes | Tags not contains “spam” |
greater than | Number comparison | Total greater than 100 |
less than | Number comparison | Stock less than 5 |
greater than or equal | >= comparison | Quantity >= 10 |
less than or equal | <= comparison | Price <= 50 |
is empty | Has no value | Phone is empty |
is not empty | Has a value | Email is not empty |
starts with | Text begins with | SKU starts with “PROD-” |
ends with | Text ends with | Email ends with “.edu” |
Condition Examples
Filter by Order Value
Send VIP email only for orders over $200:
Condition: {{Trigger.total}} greater than 200
Action: Send VIP Thank You Email
Filter by User Role
Different emails for different roles:
Workflow 1:
Condition: {{Trigger.role}} equals "customer"
Action: Send Customer Welcome
Workflow 2:
Condition: {{Trigger.role}} equals "subscriber"
Action: Send Subscriber Welcome
Filter by Product
Special handling for specific products:
Condition: {{Trigger.items[0].product_id}} equals 123
Action: Send Digital Download Email
Check for Empty Values
Only send if phone number exists:
Condition: {{Trigger.billing.phone}} is not empty
Action: Send SMS Notification
Text Matching
Filter by email domain:
Condition: {{Trigger.user_email}} ends with "@company.com"
Action: Add to Employee List
Multiple Conditions
Currently, Sequensy supports single conditions per action. For complex logic, use multiple workflows:
Alternative Approach
Instead of:
IF order > 100 AND customer is VIP
THEN send special offer
Use:
Workflow 1: High-Value VIP Orders
Trigger: Order Created
Filter: Total > 100
Condition: {{Trigger.customer_tags}} contains "VIP"
Action: Send Special Offer
Condition Patterns
Tiered Responses
Create multiple workflows for different tiers:
Workflow: Bronze Customer
Condition: {{Trigger.total}} less than 100
Action: Send Standard Thank You
Workflow: Silver Customer
Condition: {{Trigger.total}} greater than or equal 100
Condition: {{Trigger.total}} less than 500
Action: Send Silver Thank You
Workflow: Gold Customer
Condition: {{Trigger.total}} greater than or equal 500
Action: Send Gold VIP Thank You
Status-Based Actions
Condition: {{Trigger.new_status}} equals "completed"
Action: Send Completion Email
Condition: {{Trigger.new_status}} equals "cancelled"
Action: Send Cancellation Email
Category-Based Routing
Condition: {{Trigger.category}} equals "Support"
Action: Email Support Team
Condition: {{Trigger.category}} equals "Sales"
Action: Email Sales Team
Using Conditions with Variables
Numeric Comparisons
{{Trigger.total}} greater than 100
{{Trigger.quantity}} less than or equal 5
{{Trigger.discount_percent}} equals 20
String Comparisons
{{Trigger.status}} equals "active"
{{Trigger.country}} not equals "US"
{{Trigger.email}} contains "@business.com"
Boolean Checks
{{Trigger.is_first_order}} equals true
{{Trigger.has_subscription}} equals false
Best Practices
Be Specific
Narrow conditions prevent unexpected behavior:
Good: Status equals "completed"
Risky: Status not equals "pending"
Test Edge Cases
Consider what happens with:
- Empty values
- Unexpected data types
- Boundary values (exactly 100)
Document Your Logic
For complex workflows, document the conditions:
// VIP workflow: Only for orders > $500 from repeat customers
Condition: Total > 500
Condition: Order count > 1
Use Trigger Filters First
Filter at the trigger level when possible for efficiency:
// Efficient: Filter in trigger
Trigger: Order Completed (Status = completed)
// Less efficient: Check in action condition
Trigger: Order Status Changed
Condition: New status = completed
Troubleshooting
Condition Not Working
- Check variable syntax
- Verify data type (number vs string)
- Check for empty values
- Review activity logs
Unexpected Matches
- Use exact match instead of contains
- Check for case sensitivity
- Verify the variable path
Action Always Skipped
- Test with known data
- Check operator direction (> vs <)
- Verify the condition is achievable