Conditions evaluate expressions and control workflow branching through TRUE/FALSE paths.
Available Conditions
Equals
Checks if two values are equal (case-sensitive string comparison).
Type: equals
Settings:
value1: trigger.model_data.status
value2: activeReturns:
trueif values are equalfalseif values are different
Examples:
# Check user role
value1: trigger.model_data.role
value2: admin
# Check status
value1: trigger.model_data.is_active
value2: 1
# Check previous action result
value1: previous.success
value2: true
# Compare two dynamic values
value1: previous.amount
value2: trigger.model_data.thresholdContains
Checks if a string contains a substring (case-sensitive).
Type: contains
Settings:
value1: trigger.model_data.email
value2: @company.comReturns:
trueif value1 contains value2falseif not found
Examples:
# Email domain check
value1: trigger.model_data.email
value2: @company.com
# Text content check
value1: trigger.model_data.bio
value2: developer
# Tag check
value1: trigger.model_data.tags
value2: premium
# Check if previous result contains text
value1: previous.message
value2: successGreater Than
Numeric comparison (>).
Type: greater_than
Settings:
value1: trigger.model_data.age
value2: 18Returns:
trueif value1 > value2falseotherwise
Examples:
# Age verification
value1: trigger.model_data.age
value2: 18
# Price check
value1: trigger.model_data.price
value2: 100
# Compare previous amount with threshold
value1: previous.amount
value2: trigger.model_data.thresholdLess Than
Numeric comparison (<).
Type: less_than
Settings:
value1: trigger.model_data.price
value2: 100Returns:
trueif value1 < value2falseotherwise
Examples:
# Low stock alert
value1: trigger.model_data.stock
value2: 10
# Budget check
value1: trigger.model_data.amount
value2: 1000
# Compare previous count with limit
value1: previous.count
value2: trigger.model_data.limitUsing Context Variables
Conditions can access any context variable:
From Trigger
value1: trigger.model_data.status
value2: active
value1: trigger.model_id
value2: 123
value1: trigger.event
value2: createdFrom Previous Nodes
value1: previous.success
value2: true
value1: previous.status
value2: completed
value1: previous.amount
value2: trigger.model_data.thresholdNested Access
value1: trigger.model_data.profile.verified
value2: true
value1: trigger.model_data.settings.notifications
value2: enabled
value1: previous.response.data.success
value2: trueBranching
Conditions support TRUE/FALSE branching:
Condition
↓ TRUE → Action A
↓ FALSE → Action BRight-click on edges to set branch type.
Workflow Examples
Example 1: User Verification
Trigger: User Created
↓
Condition: Email contains "@company.com"
↓ TRUE ↓ FALSE
Send Employee Welcome Send Guest Welcome
↓
Grant Admin AccessExample 2: Order Processing
Trigger: Order Created
↓
Condition: Amount > 1000
↓ TRUE ↓ FALSE
Flag for Review Auto-Process
↓ ↓
Send Admin Alert Send ConfirmationExample 3: Content Moderation
Trigger: Comment Created
↓
Condition: Contains "spam"
↓ TRUE ↓ FALSE
Delete Comment Approve Comment
↓ ↓
Ban User Notify AuthorExample 4: Nested Conditions
Trigger: User Updated
↓
Condition: Role equals "admin"
↓ TRUE ↓ FALSE
Condition: Active = true Do Nothing
↓ TRUE ↓ FALSE
Grant Access Revoke AccessMultiple Conditions (AND/OR Logic)
AND Logic (Sequential)
Execute actions only if ALL conditions are true:
Condition A (Age > 18)
↓ TRUE
Condition B (Verified = true)
↓ TRUE
Action: Grant AccessOR Logic (Parallel)
Execute action if ANY condition is true:
Condition A (Role = admin)
↓ TRUE → Grant Access
Condition B (Verified = true)
↓ TRUE → Grant AccessValue Resolution
Values are resolved from context at runtime using dot notation:
# Dot notation path
value1: trigger.model_data.status
# Resolves to:
$context['trigger']['model_data']['status']Resolution Process:
- Check if value starts with
trigger.,previous., ornode. - If yes, split by dots and navigate context
- If no, treat as plain value (string, number, etc.)
- Return resolved value or null if path not found
Value Types
Both value1 and value2 support:
Plain Values
value1: active
value2: active
value1: 18
value2: 20
value1: true
value2: trueDot Notation Paths
value1: trigger.model_data.status
value2: previous.status
value1: previous.amount
value2: trigger.model_data.thresholdNote: Equals condition performs loose comparison (==), so types are converted as needed.
Debugging Conditions
Log Context Values
Add a debug email action before condition:
To: debug@example.com
Body: |
Field value: {{ trigger.model_data.status }}
Expected: activeCheck Workflow Logs
tail -f storage/logs/laravel.log | grep "Condition"Test in Tinker
use WorkflowStudio\Services\ConditionEvaluator;
$evaluator = app(ConditionEvaluator::class);
$result = $evaluator->evaluate('equals', [
'value1' => 'trigger.model_data.status',
'value2' => 'active'
], [
'trigger' => [
'model_data' => ['status' => 'active']
]
]);
// Returns: trueCommon Patterns
Email Domain Check
Condition: Contains
value1: trigger.model_data.email
value2: @company.comAge Verification
Condition: Greater Than
value1: trigger.model_data.age
value2: 18Status Check
Condition: Equals
value1: trigger.model_data.status
value2: activeAction Result Check
Condition: Equals
value1: previous.success
value2: trueCompare Two Dynamic Values
Condition: Greater Than
value1: previous.amount
value2: trigger.model_data.thresholdLow Stock Alert
Condition: Less Than
value1: trigger.model_data.stock
value2: 10Best Practices
1. Use Descriptive Values
✅ Good
value1: trigger.model_data.subscription_status
value2: active
❌ Bad
value1: trigger.model_data.s
value2: 12. Handle Missing Fields
Conditions return false if a path doesn't exist:
value1: trigger.model_data.optional_field
value2: expected_value
# Returns false if optional_field doesn't exist3. Label Branches Clearly
Right-click edges to set TRUE/FALSE labels for clarity.
4. Test Edge Cases
Test with:
- Null values
- Empty strings
- Zero values
- Missing fields
5. Use Appropriate Condition Types
✅ Use Contains for substring matching
value1: trigger.model_data.email
value2: @company.com
❌ Don't use Equals for substring
value1: trigger.model_data.email
value2: @company.com # Won't match full emailCreating Custom Conditions
See Creating Custom Nodes for how to create custom condition types.
Example custom condition:
class IsWeekdayCondition extends AbstractCondition
{
public function evaluate(array $settings, array $context): bool
{
return !now()->isWeekend();
}
}Limitations
- No complex expressions (e.g.,
value1 AND value2) - No mathematical operations (e.g.,
value1 + 10) - Case-sensitive comparisons
- Loose comparison for equals (uses
==)
For complex logic, chain multiple conditions or create custom conditions.
Next Steps
- Explore Actions
- Understand Context Variables
- Create Custom Conditions
