Adding Dynamic Text to Email Templates Based on Custom Ticket Fields

Create email templates with dynamic text that changes based on a ticket's custom field values. To do this, you need to create a custom LiquidJS code with an if/elsif/esle/endif clause, then add it to the relevant email template. 

To add dynamic custom field text to an email template:

  1. Locate the System Generated Name of the relevant custom field. Learn how
  2. In the Wix Answers app, go to Settings Tools Email Templates.
  1. (Optional) Select a language next to Email Templates in.
  2. Click Edit next to the relevant template. 
  3. Add the following text to the Email Subject or Email Body
1
{%if ticket.customFields and ticket.customFields.<fieldname> %} {% if ticket.customFields.<fieldname> == "<value1>" %} ... {% elsif ticket.customFields.<fieldname> == "<value2>" %} ... {% else %} ... {% endif %} {% endif %}
  1. Replace <fieldname> with the System Generated Name you located in step 1.
    For example: If the System Generated Name of the custom field you want to use is useros, you would replace <fieldname> with useros
  2. Replace <value1> and <value2> with the custom ticket values you want to use.
  3. Edit the LiquidJS operators in the script.
9.  Enter the text you would like to appear in the email template after each condition. For example:
1
{%if ticket.customFields and ticket.customFields.useros %} {% assign useros = ticket.customFields.useros %}  {% if useros == "Windows" %} You are using Windows {% elsif useros == "Apple" %} You are using Apple {% else %} I am not sure what you are using {% endif %} {% endif %}
10. Click Save