Skip to main content

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 equal
  • and / or - Combine multiple conditions
  • contains - Check for substrings or array values
{% if node_1.item_count > 10 %}
  You have many items.
{% endif %}

unless: Reverse Conditional Logic

The unless 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
{% unless node_1.is_active == true %}
  This user is inactive.
{% endunless %}

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
{% case node_1.plan_type %}
  {% when "free" %}
    Plan is Free Tier.
  {% when "pro" %}
    Plan is Professional.
  {% when "enterprise" %}
    Plan is Enterprise.
  {% else %}
    Plan is unknown.
{% endcase %}

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:
User Summary:
{% for user in node_1.users %}
- {{ user.name }} ({{ user.email }})
{% endfor %}

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 item
  • forloop.last - True for the final item
  • forloop.length - Total number of items in the array
Use loop variables for:
  • 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 the else block within for loops:
{% for user in node_1.users %}
  - {{ user.name }}
{% else %}
  No users found.
{% endfor %}
I