Recent searches


No recent searches

Understanding Liquid markup and Zendesk Support



Edited Jun 21, 2024


39

60

60 comments

image avatar

Greg Katechis

Zendesk Developer Advocacy

Hi Tatiana! The reason you're seeing this error is because you used a single "=" sign...you'll need to use double "=" signs like this:

{% if ticket.brand.name == "Brand A" %}

This ticket is Brand A

{% elsif ticket.brand.name == "Brand B" %}

This ticket is Brand B

{% else %}

This ticket is one of our other brands

{% endif %}

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hey Tatiana,

Perhaps you could sidestep the issue by comparing part of the string (contains) without the apostrophe, as in...

# string = 'hello world'
{% if string contains 'hello' %}
string includes 'hello'
{% endif %}

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Have you tried to wrap the string in single quotes rather than double?

0


Hi Greg Katechis,

Is it possible that the placeholders are not rendering inside of a logic tag?

I tried a very simple liquid logic expression:

{% assign my_variable = ticket.brand.name %}

and the variable does not get assigned any value.

Therefore, I can safely assume that the following expression

{% if ticket.brand.name contains 'Jameson' %}

will result in an error because it is the same thing as 

{% if NULL contains 'Jameson' %}

 

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hi Tatiana Ozaruk

{% case ticket.brand.name %}
{% when "BlueParro'th" %}
  This is brand with apostrophe
{% when "Jabrah", "biscuit" %}
  This is NOT brand with apostrophe
{% else %}
  This ticket is one of our other brands
{% endcase %}

Have you tried using case statements instead?

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hi Tatiana Ozaruk

You probably resolved this a while back, I just came across the same error message, so I wanted to add my observations here.

Placeholders have dots in them, and sometimes a composer window will interpret them as URLs, resulting in the error message "Liquid error: Unknown operator href=".

When I un-linked the placeholder text and saved the macro, the error was no more and my Liquid Markup worked.

0


Hello, 

I wanted to know if there was a way to update a field to a certain value. 
It would be quite useful for me to update it with Liquid as I need to check another field to determine to which value the second field needs to be set to. 

Unfortunately, I could not find any information about such feature. 
Does anyone knows if it is possible or not? 

I thank you in advance and wish you all a nice day! 

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hi Rawkers,

Could you please give some more context, like what field type you would want to update and would you want to use placeholders from other fields?

0


Hello Jacob,

Thanks for your quick answer! 
Both fields are multi-select. 

What I would like to do is to check the field A value and set field B to a value depending on A result. Basically, they are three choices for field B. 


(and field B could I guess be switched to a drop-down type field if that is more convenient for Liquid) 

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Rawkers Both multi-select and drop-downs use tags, so you can create triggers per value you want to set, like:

Alternatively, you could use a trigger and webhook, and have liquid markup do the value checking for field A and setting field B based on that, but if the first option is a fit, I would go that route.

1


Hello Jacob,

Thanks for your message. 
I was not aware that adding the tag would set the field to the corresponding value. I thought it was only the other way around so yup, I could setup everything using triggers and tags :) 

All sorted now, thanks again for your help!

0


Hi,

 

I'm currently attempting to assign to the ticket.tags placeholder corrected text for one of the tags via liquid implementation to webhook.

{% assign cloned_tags = ticket.tags %}
{% assign tags_without_text = cloned_tags | remove: ":clone" %}
{% assign ticket_tags = tags_without_text%}
{%assign ticket.tags=tags%}

{{tags_without_text}}
{{tags}}
{{ticket.tags}}

Barring the {{ticket.tags}} the other placeholders do correctly display all tags with all instances of :clone being removed thought it is the final one that I really want to change as that actually impacts the tickets

I understand that I need to get this all in one line for a webhook but all of my attempts have been fruitless. Does anyone know how to format this in such way that it can be properly pushed to JSON, work and alter the {{ticket.tags}} placeholder

0


Hi,

I'm having trouble with evaluating the value of a decimal field. No matter what I do, if I try to compare a value, it only evaluates on the first digit, so 

  • 4, 40, 400, and 4000 are all greater than 3000.
  • 1, 10, 100, 100000 are all less than 3000.

I've tried a couple of ways, doesn't matter:

{% if {{ticket.ticket_field_123}} < '3000.00' %}
{{ticket.ticket_field_123}} is less than $3000.
{% endif %}

{% if {{ticket.ticket_field_123}} > '3000.00' %}
{{ticket.ticket_field_123}} is greater than $3000.
{% endif %}

Or 

{% assign totalvalue=”{{ticket.ticket_field_123}}" %}
{% for totalanswer in totalvalue in %}
{% if totalanswer > '3000' %}
{{ totalanswer }} is greater than $3000.00.
{% endif %}
{% if totalanswer < '3000' %}
{{ totalanswer }} is less than $3000.00.
{% endif %}
{% endfor %}

both evaluate to > 3000 if my first digit is greater than 3.

Why?!?! How do I get around this?!?!

 

0


Hi Carmelo Rigatuso,

It depends on what type of custom ticket field ticket.ticket_field_123 is.

https://support.zendesk.com/hc/en-us/articles/4408838961562-About-custom-field-types

0


Hi Walter,

It's a decimal field, but I'm not sure what that has to do with comparison operations. 4 or 4.0 should never evaluate to greater than 3000.

0


Hi Carmelo,
It looks like the number is being treated as a string.

Try this instead.

{% if {{ticket.ticket_field_123}} < 3000.00 %}
{{ticket.ticket_field_123}} is less than $3000.
{% endif %}

0


Walter

When I try that, I get no errors when saving my trigger, but I get an error in the email notification:

BUT!!! double-quotes fixes it!

{% if {{ticket.ticket_field_123}} < "3000.00" %}
{{ticket.ticket_field_123}} is LESS THAN $3000.
{% endif %}

{% if {{ticket.ticket_field_123}} > "3000.00" %}
{{ticket.ticket_field_123}} is greater than $3000.
{% endif %}

Wow, that was a wild ride, thanks for the inspiration ;) I can't believe I didn't think of trying that yesterday.

 

1


Hello,

Is there a way to highlight text using liquid markup? We want to highlight text in our Macros to help callout important information to our end-users (if they read nothing else, at least they'll read this). Is this possible? If so, how? 

0


image avatar

Mike DR

Zendesk Customer Care

HeyA Hannah!
 
Did a thorough search on this and didn't see a liquid mark up here for highlights: Liquid for Designers.

0


Mike DR I had a feeling that would be the case. I looked EVERYWHERE for something. Thank you for your confirmation Mike!! Have a great day.

0


image avatar

Mike DR

Zendesk Customer Care

Hi Hannah!
 
You're most welcome and have an awesome day ahead too!

0


Hello,

Is it possible to change requesters based on the ticket subject using a combination of triggers and liquid markup/webhooks?

I'd use a webhook + automation combination but ideally, we'd need the requester to change immediately rather than wait the 1-hour increment.

The use case is so we don't have to manually change requesters from a no-reply address.
It's trying to create a solution to this question. Any assistance would be greatly appreciated!

0


image avatar

Dainne Kiara Lucena-Laxamana

Zendesk Customer Care

Hi Oliver!

Greg one of our developers created a workflow guide here that could serve helpful. Hope it helps!

0


Hi Zendesk community! I have a question about using Liquid Markup with Zendesk ticket tags. I've set up A/B testing in our instance (as described in this article: https://ro.roca.work/blog/ab-testing-in-zendesk) and so far, it's mostly been working for us. However, I just identified a scenario that I can't figure out how to solve.

To summarize, every ticket that is created gets assigned either the control or experiment tag. The problem occurs only sometimes with tickets created as followups, as it's possible for a ticket to carry over the previous tags, like control, but then get assigned the experiment tag by the webhook. How would I use liquid markup in this JSON response to tell it not to fire if a ticket already has the control or experiment tag?

{% assign randomizer = ticket.id | modulo:2 %}

{% case randomizer %}

{% when 0 %}

{“ticket”: {“additional_tags”:[“control”]}}

{% when 1 %}

{“ticket”: {“additional_tags”:[“experiment”]}}

{% endcase %}

Thanks in advance for the help!

0


image avatar

Rafael Santos

User Group Leader

Andy F. , I'd use the PUT /api/v2/tickets/{ticket_id}/tags endpoint instead of PUT /api/v2/tickets/update_many, as the latter creates a background job, which may be rate limited to 30 concurrent jobs for the entire instance.

You could use the Add Tags endpoint, as mentioned above, with a payload such as the following:

{
{%- assign randomizer = ticket.id | modulo: 2 -%}
{%- case randomizer -%}
	{%- when 0 -%}
		{%- assign randomTag = 'control' -%}
	{%- when 1 -%}
		{%- assign randomTag = 'experiment' -%}
{%- endcase -%}
	"tags": ["{{ randomTag }}"]
}

As for your other question:

How would I use liquid markup in this JSON response to tell it not to fire if a ticket already has the control or experiment tag?

The following trigger conditions could help you exclude this from firing on follow-up tickets with the tags:

  • Ticket Is Created
  • Channel Is not Closed ticket
  • Tags Contains non of the following: [ control, experiment ]

Of course, it'll depend on your specific use case. You could also try iterating over the {{ticket.tags}} placeholder and use Liquid's contains.

2


Rafael Santos ah of course! I was overthinking this, believing I had to add the exclusion to the JSON when of course I can just add it to the main trigger. Thank you!

0


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:

{% if ticket.form == "Form 1" %}
Hello
{% elsif ticket.form == "Form 2" %}
World
{% endif %}

Using the ticket.ticket_form placeholder doesn't seem to work either. Any advice? Thank you!

0


image avatar

Jacob the Moderator

Zendesk LuminaryCommunity Moderator

Hi Dylan Tragjasi 

Aside from using the end user form name, it looks like you're missing part of the form name placeholder.

Try and see if the below works for you.
{% if ticket.ticket_form == "Form 1" %}
Hello
{% elsif ticket.ticket_form == "Form 2" %}
World
{% endif %}
 

1


Thanks Jacob the Moderator - I had a feeling this was going to be the solution but for some reason preferred to bash my head against a wall for a while. This works great, thank you for the help! 

1


Is it possible to use liquid markup in zendesk on the new object type (custom objects) Thank you

0


Please sign in to leave a comment.