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:

  1. Configure your trigger
  2. Set filter conditions
  3. 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:

  1. Select an action
  2. Click the Condition icon
  3. Configure the condition
  4. Action only runs when true

Condition Operators

OperatorDescriptionExample
equalsExact matchStatus equals “completed”
not equalsDoes not matchRole not equals “admin”
containsText includesEmail contains “@gmail”
not containsText excludesTags not contains “spam”
greater thanNumber comparisonTotal greater than 100
less thanNumber comparisonStock less than 5
greater than or equal>= comparisonQuantity >= 10
less than or equal<= comparisonPrice <= 50
is emptyHas no valuePhone is empty
is not emptyHas a valueEmail is not empty
starts withText begins withSKU starts with “PROD-”
ends withText ends withEmail 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

  1. Check variable syntax
  2. Verify data type (number vs string)
  3. Check for empty values
  4. Review activity logs

Unexpected Matches

  1. Use exact match instead of contains
  2. Check for case sensitivity
  3. Verify the variable path

Action Always Skipped

  1. Test with known data
  2. Check operator direction (> vs <)
  3. Verify the condition is achievable