Unless Conditions
Learn how to use unless conditional logic in your workflow message templates
The unless
helper is the inverse of the if
helper. It executes the block if the conditional value is empty or equal to 0
.
Think of unless
as “if not” - it’s particularly useful when you want to
check if something is missing or empty.
Basic Usage
If lead.phone
is empty:
If lead.phone
exists, nothing will be rendered.
With Else Block
Like the if
helper, unless
can include an else
block:
If quote.event_address
is empty:
If quote.event_address
exists:
Common Use Cases
Missing Contact Information
Incomplete Quote Details
Missing Company Information
Best Practices
- Use
unless
when checking for missing or empty values - Consider using
if
when the logic is complex or needs multiple conditions - Keep the logic simple and readable
- Test templates with both empty and filled data
Like the if
helper, unless
treats zero (0
) as a falsy value. If you need
to treat zero differently, consider using the if
helper with
includeZero=true
.
Comparison with If Helper
Here’s the same logic written with both unless
and if
:
Using unless
:
Equivalent using if
:
Choose the one that makes your template more readable and intuitive.
Was this page helpful?