Line breaks in {{ticket.comments_formatted}} | Community
Skip to main content

Line breaks in {{ticket.comments_formatted}}

  • June 16, 2021
  • 3 replies
  • 0 views

I've read through various ZD help articles and the liquid dev guide but so far I have not been able to find a solution

I'm want to use a macro which does several things at once, including making a "comment/description" which contains the placeholder {{ticket.comments_formatted}}.  My expectation is this would display the previous ticket comments in a formatted manner.  What I am finding though is that line breaks are not respected.

The flow is that the Customer submits a case.  The contents of the case are:

Line 1

Line 2

Line 3

I then apply the macro. The result of using this placeholder is the comments displayed are not the individual lines as I've shown above.  Instead I get: Line 1Line 2Line 3

It doesn't matter whether the customer submits the case through email or by web portal, the result is the same.

How do I maintain original formatting when using the {{tickets.comments}} placeholder?

3 replies

Dave12
  • June 17, 2021

Hi Stephanie,

Can you help us understand why you want to add the comment thread into a single comment via a macro, and not just include the comment thread in an outgoing email notification in a trigger?


  • Author
  • June 17, 2021

Hi Dave,

Sure - I was trying to be generic in my first message but let me explain the flow.  It's not technically a customer that initiates the case, but our sales team.

When an invoice is paid, our sales team provides the customer's accounts receivable department with plain text license key(s) for each of the products they've purchased.  Each of the license key lines are separated with a line break

The issue that we're trying to solve is that the AR team on the customer end do no always forward the license keys to the techs responsible for applying the license key, so we want to get those keys in to the right hands.

Here's the desired flow:

1)  Internal Sales team emails customer AR with license keys, and BCC's my team which creates a ticket

2) Someone on my team claims the ticket, and changes the ticket requestor from our Sales person to a tech person on the customer side

3) Once the ticket is assigned and the requestor changed, then I want to apply a macro that sets priority, adds tags, puts the ticket in pending, and adds a public comment.  The public comment is basically "hey tech person, here's your keys and a few KB articles explaining how to apply the keys"

The difficulty I am having is making those keys visible to the tech person via email.  Because the tech person wasn't included on the initial case open, putting the comment thread in an outgoing email notification wouldn't work.

I've tried :  {{ticket.comments}}, {{ticket.comments_formatted}} , {{ticket.description}} {{ticket.description_formatted}}. 

Your suggestions on how to achieve this flow would be appreciated!


James172
  • July 1, 2021

Hi Stephanie,

Thanks for hanging in there for us! For us to be able to assist you better, we'll create a ticket for this so you should receive an email from us shortly.