If Conditions
Learn how to use if/else conditional logic in your workflow message templates
The if
helper allows you to conditionally include content based on whether a value exists. You can add an {{else}}
step to return a different value when the if
check is empty/false.
Empty values and zero (0
) are considered false when evaluating an if
condition.
You can add an optional setting to treat zero as true.
Basic Usage
If lead.company_name
exists:
If lead.company_name
is empty:
Multiple Conditions
You can check multiple conditions in the same template:
Nested Conditions
You can nest conditions for more complex logic:
Treat Zero as True
If you want the if statement to consider a value of 0
as true, use the optional includeZero
setting.
For example, if your if statement was {{#if 0 includeZero=true}}
, then a value of 0
would satisfy and trigger the value within the if
statement.
Best Practices
- Always provide an
else
block for critical information - Use nested conditions sparingly to maintain readability
- Test your templates with both filled and empty data
- Consider using the default helper for simpler fallback cases
Preview your templates with different quotes to ensure your conditional logic works as expected in all scenarios.