Suggestion: Add newline formatting in macros for Custom Ticket Fields (multi-line text)

5 Comentarios

  • Andrew Snell

    Hi Robert,

    I came across this post facing a similar situation but managed to find a solution. You can use url_encode to convert \n to a usable url-safe set of chars to split on:

    The following should work for you:

    {% assign address = ticket.ticket_field_360033071872 | url_encode | split: "%0A" %}

     

    1
  • Robert Schwarz

    Hey Andrew,

    that's a much better approach than my workaround idea with commas! Thank you so much for the input :)

    Best

    0
  • Kyle Beaulieu

    This area is definitely not my forte. This is the code I'm using in my macro:

    {% assign address = ticket.ticket_field_1260825395049 | url_encode | split: "%0A" %}
    {% for line in address %}
    {{ line }}
    {% endfor %}

    Which renders a result that's close but no cigar:

    Does anyone know how to get rid of the + symbols? I know this is caused by the url_encode changing spaces into +, but I can't figure out how to work around this. 

    0
  • Julian Din

    Hi Kyle

    Just used a similar solution to yours.

    You can use the {{ line | url_decode }}, it will remove + symbols and all other previously encoded symbols.

    {% assign address = ticket.ticket_field_1260825395049 | url_encode | split: "%0A" %}
    {% for line in address %}
    {{ line | url_decode }}
    {% endfor %}
    0
  • Kyle Beaulieu

    Julian Din Thank you!!! This worked like a charm. I owe you a coffee. 

    0

Iniciar sesión para dejar un comentario.

Tecnología de Zendesk