Liquid markup is commonly used in business rules to customize comments and email notifications. Liquid markup case statements enable you to define multiple messages to be used dynamically based on some attribute of the ticket.
This article provides a few examples, such as supporting responses in multiple languages. Many companies and organizations support end users who speak languages other than English. There are several ways to manage this. For more complex messages or many languages, we recommend using dynamic content. For simple messages in a few languages, liquid markup can be a great fit.
Using a Liquid markup case statement to support multiple languages
When your account supports multiple languages, users can specify their preferred language in their profiles. Then, you can reference the user's preferred language in a series of conditional statements within the body of the message you're defining for the automation, macro, or trigger.
The following example shows the email body for a trigger's Notify by: User email action. In this case, the account's default language is English, so we didn't need to label it within the Liquid markup formatting.
{% case ticket.requester.language %}
{% when 'Italiano' %}
Ciao,
La tua richiesta (#{{ticket.id}}) è stata ricevuta, è stato esaminato dal nostro staff di assistenza.
Per esaminare lo stato della richiesta e aggiungere ulteriori commenti, segui il link qui sotto:
http://{{ticket.url}}
{% when 'Danish' %}
Hej,
Din anmodning (# {{ticket.id}}) er blevet modtaget og bliver gennemgået af vores supportmedarbejdere.
At gennemgå status for anmodningen og tilføje yderligere kommentarer, skal du følge nedenstående link:
http:// {{ticket.url}}
{% else %}
Hello,
Your request (#{{ticket.id}}) has been received, and is being reviewed by our support staff.
To review the status of the request and add additional comments, follow the link below:
http://{{ticket.url}}
{% endcase %}
Using a Liquid markup case statement to dynamically change the text based on a dropdown field's value
-
FIELDID
is replaced with your custom drop-down field's ID. - Each
{% when "Value X" %}
statement is replaced with one of the drop-down field's defined options. - Each
Your text X here.
statement is replaced with your desired response for the field value preceding it.
{% case ticket.ticket_field_option_title_FIELDID %}
{% when "Value 1" %}
Your text 1 here.
{% when "Value 2" %}
Your text 2 here.
{% when "Value 3" %}
Your text 3 here.
{% else %}
-
{% endcase %}
Using a Liquid markup case statement to create other dynamic responses
You can use a similar structure to create dynamic responses in contexts other than preferred language. For example, a similar case structure could be used if you wanted to respond based on the user's organization. In that scenario, you'd define the case as {% case ticket.organization.name %}
and the repsonse for each organization would be preceded by {% when 'OrganizationName'
%}
.
13 comments
ROM HIRSH
I have been attempting to copy the comment text (last comment) from one ticket and create another. It's working fine except for the formatting of the comment. I seem to be losing HTML tags and content while calling the new ticket API request.
I tried to structure the 'html_body' using {{ticket.latest_comment_formatted}} as well as with DC like:
But I am losing the original comment formatting in the process - has anyone been able to copy the last comment with formatting and attachments over API?
Example comment (converted to HTML)
1
Giuseppe
Hi Rom,
It's possible that {{comment.value_rich}} is not returning an HTML formatted value because it is under ticket.comments, which displays all the comments in a ticket in unformatted text. See Comment Data
Instead, could you try using {{ticket.latest_public_comment}} or {{ticket.latest_public_comment_rich}}?
On another note, you may want to check the Linked Ticket app in our Marketplace and see if this also helps with your workflow.
Thanks!
0
ROM HIRSH
@...
I tried these as well but still, I cannot get HTML to render while updating the ticket via HTML. The use of the linked tickets app is not good for me as it required much manual work and I am trying to automate this.
Any other suggestions?
0
Giuseppe
Hi @...
I'll be creating a ticket for your query and send an email to you so we can investigate further.
Thanks!
0
Khajik Khajadourian
What is the difference between using dynamic content for multiple languages and liquid markup?
1
Bry Fitzgerald
2
Yvonne P.
Detailed Question on this: having a clickable logo in our agent signature in the brand setting (that works already) but i need it to work dynamically, so eg. when customer language is german = logo should lead to www.brand.de / when customer language is english = logo should go to www.brand.com
I assume this should be possible with liquid markup, BUT I am new to this - so hoping someone here can help.
In brand setting "signature" right after the logo - can I just add something like this:
{% when 'Italiano' %}(www.brand.it)
{% when 'German' %}(www.brand.de)
{% when 'English' %}(www.brand.com)
Appreciate anyone trying to help out on this :)
Kind regards,
Yvonne
1
Dylan Tragjasi
Does anyone know if the ticket form object is accessible when using liquid markup? I'm trying to create a macro with different content depending on the current form selected on the ticket. I've tried many variations of the following but can't seem to get it to work:
Using the ticket.ticket_form placeholder doesn't seem to work either. Any advice? Thank you!
0
Jacob the Moderator
Hey Dylan Tragjasi
I'm not sure this is documented, but from my experience, it seems the value you're evaluating is the one shown to end users. So if you have a form called “Consumer L1” for your agents, and “Consumer requests” for your end users, you would need to use the latter for it to work.
You can check this in Admin Center on the individual forms.
0
Cameron Eng
Has anyone been able to reference custom user dropdown fields with liquid markup? I'm trying the syntax “{% case ticket.requester_field_option_title_FIELDID %}” but no luck so far
0
Carmelo Rigatuso
Cameron Eng A bit late, but if you haven't figured it out yet, it's ticket.ticket_field_option_title_12345 not ticket.requester_field_option_title
1
Amar Taggar
Hey Team, I am trying to use this “Using a Liquid markup case statement to dynamically change the text based on a dropdown field's value”
It works with a regular drop down just fine, but our use-case needs it to work with a cascaded dropdown field. Can someone help me on how to use it?
It works with regular drop down like “XYZ”
It doesn't work with “XYZ::ABC”, I even tried with just "ABC". Any ideas on how to do this?
0
Carmelo Rigatuso
Amar Taggar
I would try using the ticket.ticket_field_123 format in the case, and use the tags associated with the value you want, and then if you need to display the value, use ticket.ticket_field_option_title. So something like:
Note that I'm not 100% sure on the syntax if you're evaluating tags instead of text. you may not need the quotes.
0