How to Use Nested If Conditions in Liquid Email Templates
This article explains how to customize email notifications in BoldDesk using nested if conditions in Liquid templates. With this method, you can display different messages based on multiple ticket field values. It helps tailor communication for various scenarios, ensuring customers receive context-specific updates.
Steps to Configure Nested If Conditions in Liquid Email Templates
-
Access and Enable Email Notification Events
-
Go to Admin → Email Notifications in the Agent Portal.
-
Under the Contact tab, enable the target event (e.g., New Ticket Created).
-
-
Create a New Email Template
-
Go to Templates and click on Create Template for the relevant event.
-
Add a Template Name and a Subject.
-
In the Description optionally click on Insert Placeholders to add dynamic fields.
-
Click Insert Liquid Template and paste your nested
ifcondition Liquid code.
-
-
Save and Assign the Template
-
Click Add to store the template.
-
Set the configured template for the relevant event, replacing the default.
-
Sample Liquid Template with Nested If Conditions
Here is an example of customizing automated notifications using conditional statements based on ticket category and type.
{% if ticket.category == "Technical Support" %}
{% if ticket.type == "Query" %}
Hello {{ticket.requester.displayname}},
We’ve received your ticket (#{{ticket.id}}) regarding installation issues. Our technical team will review your request and get back to you shortly.
Thank you,
Support Team
{% else %}
Hello {{ticket.requester.displayname}},
We’ve received your ticket (#{{ticket.id}}) under the Product Support category. Our team will review it and respond as soon as possible.
{{ticket.description}}
Thank you,
Support Team
{% endif %}
{% else %}
Hello {{ticket.requester.displayname}},
We’ve received your ticket (#{{ticket.id}}). Our team will review your request and respond as soon as possible.
{{ticket.description}}
Thank you,
Support Team
{% endif %}
Frequently Asked Questions (FAQs)
-
How do I turn on the email for a specific situation, like when a ticket is created?
In the Agent Portal, go to Admin → Email Notifications → Agent / Contact / Watchers. Find the event you want (for example, Ticket Created On Behalf Of Requester) and switch it On. Then open that event to configure its template. -
Where do I paste the Liquid code that shows different messages in a template?
Open an event → Templates → Create Template. Add a Template Name and Subject. In Description, click Insert Liquid Template, then paste your Liquid code (theif/elseconditions) where you want it to appear. -
How do I restore the default email content if I don’t want custom messages anymore?
In the event’s Templates tab, switch each brand back to the Default template. You can also toggle the event Off if you don’t want the email sent at all.