Understanding Liquid markup and Zendesk Support

Return to top
Have more questions? Submit a request

100 Comments

  • Donald Cornel

    Hi Raman Kalia,

    Sorry I missed to respond on your comment.

    I just have follow up question on that.

    How can I copy the value of that field to another field without me manually typing the value?

    Like {{ticket.field1}} = {{ticket.field2}}

    0
  • Brett Bowser
    Zendesk Community Team

    Hey Donald,

    I believe you could also set this up by using a URL Target if you're unable to get this through liquid markup.

    You would first need to grab your custom field ID's, then create a target using the following URL: https://yoursubdomain.zendesk.com/api/v2/tickets/{{ticket.id}}.json?ticket[custom_fields[fieldID2={{ticket.ticket_field_fieldID1}}.

    FieldID2 is the field you're copying to.
    FieldID1 is the field you're copying from.

    Set the method to PUT as shown in my screenshot below:

    You can then set up a trigger to look similar to the following:

    I tested this on my account and it does copy the data from my custom text field to another custom text field.

    I hope this gets you what you're looking for!

    0
  • Donald Cornel

    Hi Brett I am using two custom fields, the source is a dropdown while the destination is a text.

    Here's my target url: https://mydomain.zendesk.com/api/v2/tickets/{{ticket.id}}.json?{{ticket.ticket_field_900005248766}}={{ticket.ticket_field_option_title_360027440631}}.

    I have followed your steps, but the target doesn't fire for me.

    0
  • Brett Bowser
    Zendesk Community Team

    Hey Donald,

    Could you try using this target URL instead?

    https://mydomain.zendesk.com/api/v2/tickets/5642019.json?ticket[custom_fields[900005248766={{ticket.ticket_field_option_title_360027440631}}

    It looks like the above worked on my account.

    Let me know if you run into any issues.

    Thanks!

    0
  • Anais

    Hi there. I'm using Liquid in my macro, but I can't figure out how to check if a chekbox is checked.

    I tried things like fieldID[checked]  or fieldID.checked : {% if ticket.ticket_field_360016124819[checked] %}

    Thanks in advance for your help !

    1
  • Dan Ross
    Community Moderator

    Hey Anais,

    As far as I know, Liquid can't check field states that way. In this case, try making sure your checkbox field applies a tag when checked and then test for the presence of that tag. If it's there, the field is checked, otherwise it's not.

    Something like this might help get you started.

    {% if ticket.tags contains ‘checkbox_tag' %}
    1
  • Anais

    Dan Ross

    Thank you so much Dan for your prompt assistance.

    Indeed, it works with the tag.

    You saved my day !

     

    1
  • Daniël Nieuwendijk

    This should also work, because a checkbox is true if it is checked. 

    {% if ticket.ticket_field_360016124819 %}your text here{% endif %}
    0
  • Anais

    Hi Daniel !
    Thanks for your suggestion.
    I gave it a try but I couldn't make it work.
    Have you ever used it ?
    My understanding is that unlike a client side language like javascript, Liquid retreives server side information but does not access to DOM element and this would explain why it can't tell if a checkbox is checked or not.
    I hope someone could confirm this.

    0
  • Jonathan March
    Community Moderator

    Using a tag as Dan Ross suggested is the standard supported way.

    0

Please sign in to leave a comment.

Powered by Zendesk