Plan requirement
| Subscription | Any plan |
| Access | Admin |
Liquid adds conditions and loops to your messages, so one trigger can say different things depending on the ticket.
What it adds
A placeholder inserts a value. Liquid lets you decide whether to insert anything at all, choose between wordings, and loop over a list.
That turns four near-identical triggers into one, which is the main reason to reach for it.
The three things it is genuinely used for
1. Hiding a sentence when there is no value
The most valuable use. Wrap the sentence in a condition testing whether the field has something in it, and the empty-placeholder problem disappears.
2. Different text per language or brand
A case statement on the requester's language or the ticket's brand. For languages, dynamic content is usually cleaner; for brands, Liquid is often simpler than duplicating the rule.
3. Different text per field value
One notification whose wording follows the category, instead of five triggers that drift apart over two years.
When not to use it
Liquid is code in a text box with no syntax checking and no error message. A mistake produces a message that is subtly wrong or does not send, and the next admin has to read it to find out what it does.
Two branches is fine. Ten nested conditions in an email template is a maintenance problem you are handing to someone else.
Test it properly
Every branch, on a real ticket. A Liquid condition that is never true fails silently, and nothing tells you the sentence has been missing from your emails for six months.
Comments
0 comments
Article is closed for comments.