Liquid Markup is a powerful tool for customizing and manipulating data in Zendesk. See this article for a general overview of Zendesk placeholders / Liquid Markup.
A common use of Liquid Markup is to create conditional statements to define what data is shown and to whom it is shown.
|
Did you know... You can find and test out any liquid that you produce in real time using the free Liquid Placeholders app that you can install here. Liquid markup can be used to build flexible workflows using a multitude of SweetHawk apps including Tasks and sub-tickets, Approve, Timers, Calendar, Notify and more! |
In Zendesk, tickets are at the core of how you interact with customers. Zendesk tickets have fields for things like status, priority, and assignee. You can also have fields associated with a user or an organization. These fields can be accessed and manipulated using Liquid Markup, allowing for highly customizable workflows and outcomes.
The basic syntax for an if statement in Liquid Markup is {% if condition %} ... {% endif %}
, where the condition
is a statement that evaluates to true or false. For example, you could use an if statement to check the status of a ticket and display a message to the user:
{% if ticket.status == "open" %}
Your ticket is currently open. Please be patient while we work on a solution.
{% endif %}
{% if ticket.ticket_field_option_title_1900000684288 == "Small ($0 - $100)" or ticket.ticket_field_option_title_1900000684288 == "Medium ($101 - $300)" %}
<b>SMALL/MEDIUM REFUND:</b>
Order ID: {{ticket.custom_field_360049059274}}
Refund amount: {{ticket.custom_field_360049059534}}
{% elsif ticket.ticket_field_option_title_1900000684288 == "Large ($301 - $1000)" or ticket.ticket_field_option_title_1900000684288 == "Very large (>$1001)" %}
<b>BIG REFUND:</b>
Order ID: {{ticket.custom_field_360049059274}}
Refund amount: {{ticket.custom_field_360049059534}}
Refund Size: {{ticket.ticket_field_option_title_1900000684288}}
Reason for refund: {{ticket.custom_field_360049048353}}
Amount paid: {{ticket.custom_field_360049059434}}
Refund Type: {{ticket.ticket_field_option_title_360049059514}}
Date Paid: {{ticket.custom_field_360049059474 | date: "%e %b %Y"}}
{% else %}
Refund size has not been set.
{% endif %}
{% unless ticket.status == "solved" %}
Your ticket is still open. We apologize for any delays in resolving the issue.
{% endunless %}
In Zendesk, there are many fields associated with users and organizations. These fields can be accessed and manipulated using Liquid Markup. For example, you could use a conditional statement to check whether a user's organization is a certain type:
{% if user.organization.status_level == "premium" %}
Thank you for being a premium customer! You have access to our exclusive support team.
{% endif %}
You can also use control flow tags like elsif and else to create more complex conditions. For example, you could use an if/elsif statement to check the priority of a ticket and display a message to the user:
{% if ticket.priority == "high" %}
This is a high-priority ticket. We will work to resolve the issue as soon as possible.
{% elsif ticket.priority == "medium" %}
This is a medium-priority ticket. We will work on resolving the issue soon.
{% else %}
This is a low-priority ticket. We will get to it as soon as we can.
{% endif %}
Finally, you can use case/when statements to create a switch statement. This is useful when you want to execute a particular block of code when a variable has a specified value. For example, you could use a case statement to display a different message depending on the type of organization a user belongs to:
{% case user.organization.status_level %}
{% when "premium" %}
Thank you for being a premium customer! You have access to our exclusive support team.
{% when "standard" %}
You are a valued customer! Please allow us some time to respond to your ticket.
{% else %}
We're sorry, we don't recognize your organization type. Please contact our support team for assistance.
{% endcase %}
In summary, Liquid Markup is a powerful tool for customizing and manipulating data in Zendesk. By using control flow tags like if, unless, elsif, else, case, and when, you can create highly customizable views and automations that take advantage of the many fields associated with tickets, users, and organizations.