Liquid Tags for Workflow Logic
Liquid tags provide programming logic for workflow text and data transformations. Create conditional blocks, loops, and decision trees that respond dynamically to workflow data and business conditions. Tag capabilities:- Conditional content display with if/else logic
- Data iteration with for loops
- Multi-condition routing with case statements
- Complex boolean operations
- Dynamic workflow responses
if/else/elsif: Conditional Workflow Logic
The most essential tag for creating smart workflows that respond to data conditions. Build branching logic that displays different content based on workflow data values. Common use cases:- Personalized notifications based on user data
- Different API calls based on conditions
- Conditional error handling and responses
- Dynamic content generation
Comparison Operators for Workflow Conditions
Use these operators to create intelligent workflow logic:==
- Equals (exact match)!=
- Not equals (excludes values)>
/<
- Greater/less than (numeric comparison)>=
/<=
- Greater/less than or equaland
/or
- Combine multiple conditionscontains
- Check for substrings or array values
unless: Reverse Conditional Logic
Theunless
tag executes content when conditions are not met, providing cleaner syntax for negative conditions in workflows.
When to use unless:
- Error handling and validation
- Default content when conditions fail
- Cleaner negative condition syntax
case/when: Multi-Condition Workflow Routing
Case statements provide clean, efficient multi-condition logic for workflows. Perfect for handling multiple workflow paths based on status, type, or category values. Common workflow applications:- Order status handling (pending, processing, shipped)
- User role-based content
- Payment method processing
- Content categorization and routing
for: Process Arrays and Lists in Workflows
For loops iterate through arrays and lists from workflow data, enabling batch processing and dynamic content generation for multiple items. Essential for workflows that handle:- Multiple user records from API responses
- Product catalogs and inventory lists
- Batch notification processing
- Report generation with multiple data points
Basic For Loop: Process Workflow Arrays
Iterate through arrays from previous workflow steps to generate dynamic content:Loop Variables: Track Iteration Progress
Access loop metadata for advanced workflow logic and formatting:forloop.index
- Current iteration number (starts at 1)forloop.first
- True for the first itemforloop.last
- True for the final itemforloop.length
- Total number of items in the array
- Adding separators between items
- Special formatting for first/last items
- Progress tracking in workflows
- Conditional logic based on position
Empty Array Handling: Fallback Content
Provide fallback content when workflow arrays are empty using theelse
block within for loops: