Using zendesk tags in liquid markup
RespondidaI would like to change the text within a notification based upon the value of a tag. I know how to use an "If" in liquid markup to test the value of a field but has anyone got a neat way of detecting whether a tag is present? I really do not want to add yet another custom field although that would be the easy solution.
Thanks in advance for any suggestions
-
I found the answer myself -- or an answer anyhow!
{% capture alltags %}{{ ticket.tags | remove: "xxxtesttagxxx" }}{% endcapture %}{% capture newtags %}{{ ticket.tags | remove: "testtag" }}{% endcapture %}{% if alltags == newtags %}No overload{% else %}Overloaded{% endif %}
I am sure there might be a slightly better way but I stopped after this worked!
-
Colin hi!
Thank you for you message.
I wonder if I can use case statement in order to show the text that matches the tag. I'm adding tag to the ticket via my webform, but this does not work :(Do you have any idea why?
{% case ticket.tags %} {% when tag_name_1 %}
first text template
{% when tag_name_2 %}
second text template
{% else %}
another template
{% endcase %}Any ideas :)?
-
@Colin -- Cool stuff! Is it possible to use some of that language to add/remove ticket tags based on ticket fields using Markup?
Basically:
casewhen_ticketfield_123 = "ticket_field"
ticket.tags add" "tag_abc"
I know the syntax of what I just wrote is wrong, but I'm hoping you can share the scope of using liquid markup to dynamically add tags to tickets.
Thanks! -
Barry
Liquid Markup allows you to display different content in comments. If cannot be used to update ticket fields.
It sounds like you need a custom trigger. After submitting a ticket, the trigger would check the value of your custom field and add the tag to the ticket. This is not as flexible depending on the type of custom field. For example, if it is a free text field you can only check if a value is present or not present.
Some custom fields can automatically add tags to tickets- for example, check boxes and drop down lists.
Hope that helps.
-
Thanks Graeme. I was hoping to avoid needing all these triggers :( Essentially I want to add tags based on two ticket field values being present and was hoping I could use markup to get there.
La publicación no admite más comentarios.
5 Comentarios