Recent searches


No recent searches

Multi-Select Liquid Markup Case Statement

Answered


Posted Apr 12, 2022

I am attempting to determine what values are contained in a multi select and based on that, send certain content in an email through Dynamic Content.  What is the best way to traverse the values of the Multi Select?

{% case ticket.ticket_field_80818947 %}
{% when 'VALUE 1' %}
<p>Content for VALUE 1</p>
 {% when 'VALUE 2' %}
<p>Content for VALUE 2</p>
 {% when VALUE 3' %}
....
 {% endcase %}            


0

1

1 comment

image avatar

Christopher Kennedy

Zendesk Developer Advocacy

Hi Ronald,
 
The multi-select value will be a string of the selected tag values for the field separated by a space.  The simplest approach to evaluating the selected values involves using an if statement with the contains operator.  So from your example:
 
{% if ticket.ticket_field_80818947 contains 'VALUE_1' %}
<p>Content for VALUE_1</p>
{% endif %}
{% if ticket.ticket_field_80818947 contains 'VALUE_2' %}
<p>Content for VALUE_2</p>
{% endif %}
 
If the selected value is VALUE_1 or VALUE_2, the content for that value is displayed.  If both are selected, then the content for both values are displayed.
 
Best,

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post