Understanding Liquid markup and Zendesk Support

Return to top

42 Comments

  • Dave Dyson
    Zendesk Community Manager
    Hi Tatiana,
     
    The only brand placeholder that should work is ticket.brand.name; there are no placeholders for the brand id -- see Zendesk Support placeholders reference.
    0
  • Tatiana Ozaruk

    Hi Dave, 

    I have updated the liquid code to the following:

    {% 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 %}

     

    However, I am getting the following error when I try to apply the macro to a ticket: 

    Liquid error: Unknown operator href=

     

    Are you able to tell me what is causing the error in my code? 

    Thank you!

    0
  • 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
  • Tatiana Ozaruk

    Hi Greg, 

    Thanks for the follow up. I think we are closer to a solution now. I have isolated the issue and believe it's because one of the brands in the IF statement has an apostrophe in it. The other brand in the if statement doesn't have an apostrophe, so I was able to verify that the if statement worked for the non-apostrophe brand. How can I escape the apostrophe? 

    I have it set to the following - 

    {% elsif ticket.brand.name == "Jefferson''s Bourbon" %}

    I have also tried the following - 

    {% elsif ticket.brand.name == "Jefferson's Bourbon" %}

    Both result in the same error when I try to apply the macro:

    Liquid error: Unknown operator href=

    Can you please advise how I can include the apostrophe in the IF statement criteria? 

    0
  • Tatiana Ozaruk

    Hello,

    Is anyone on the team able to follow up on the above regarding escape quotes? I have tried the above two options and they both cause the Unknown operator error.

    Can you please advise? 

    Thank you!

    0
  • Jacob Christensen
    Community 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
  • Tatiana Ozaruk

    Hi Jacob,

    I have updated my macro to the following, but it's still giving me the Unknown operator error - 

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

    This ticket is Jameson

    {% elsif ticket.brand.name contains "Jefferson" %}

    This ticket is Jefferson

    {% else %}

    This ticket is one of our other brands

    {% endif %}

     

    0
  • Jacob Christensen
    Community Moderator

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

    0
  • Tatiana Ozaruk

    Hi Jacob,

    I have tried both, and they result in the same error. 

    0
  • Walter

    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
  • Jacob Christensen
    Community 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
  • Jacob Christensen
    Community 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

Please sign in to leave a comment.

Powered by Zendesk