By default, many business rules use the {{ticket.comments_formatted}} placeholder to include comments into email notifications. If you want more control over how the comments are presented to requesters, you can access more details about comments and their attachments using Liquid markup.
A comment is an element within a ticket and there are a number of placeholders available that you can use to include comments in email notifications. For example, you can include all comments, public comments, the last comment, etc (see Comment data).
If you want more control over how comments are displayed in email notifications, you can use Liquid markup and a for loop, as in this example:
{% for comment in ticket.comments %} Comment: {{comment.created_at}} {{comment.created_at_with_time}} {{comment.author.name}} {{comment.value}} Attachment: {% for attachment in comment.attachments %} {{attachment.filename}} {{attachment.url}} {% endfor %} {% endfor %}
This returns the items in both arrays (ticket.comments and comment.attachments). In other words, the properties for every comment and attachment contained in the ticket.
{% for comment in ticket.comments limit:1 offset:0 %}You can do a lot with arrays in for loops. Refer to the Liquid documentation (Liquid for Designers) for more details.
For more information on how Liquid markup can be used, see Understanding Liquid markup and Zendesk Support.
13 comments
Curtis Kuipers
Late response, 4610403076762 but maybe {{comment.value_rich}} works for you?
0
eclect_admin
上記ありがとうございます。大変助かります。
ご確認いただきました通り、下記設定を行っており、10MB未満のファイルの場合は、メール添付形式で、送信先に着信をしていることを確認しています。
(10MBを超える場合は、その他の10MB未満のファイルがあっても、全て、添付ファイルもURLリンクも存在しないことを確認しました)
{% for comment in ticket.comments limit:1 offset:0 %}
{{comment.value_rich}}
{% endfor %}
ご指摘を踏まえ、下記へ変更し、同様のテストを行いましたが、先の現象と同様となってしましました。
{% for comment in ticket.comments limit:1 offset:0 %}
{{comment.value_rich}}
{% endfor %}
{% for attachment in comment.attachments %}
{{attachment.url}}
{% endfor %}
10MB以上のファイルを添付した場合のみ、添付ファイルが添付されない現象が発生していることから、この観点で、調査や対策について、ご教授いただくことは可能でしょうか?
なお、当該テストを行ったチケットは、下記となります。
https://nomura-office.zendesk.com/agent/tickets/519
以上、お手数をおかけしますが、よろしくお願いいたします。
0
Carly Adams
Hi, I think I wasn't clear in my last comment.
In sted of {{comment.value}} I need something like {{ticket.comment_html_body}}
This way, it is formatted correctly and will display images and more.
how do I do this?
1
Vicky
1263213596549
It works at the beginning, but when the end user replied, it still shows the Fixed name, and the content all mixed together,
the below is what i had
{% for comment in ticket.comments %}
<hr/>
{{#if author.agent}}
<b>Fix Name</b>
{{else}}
{{author.name}}
{{/if}}
<span style="color: #999999;"> {{comment.created_at_with_time}}<br /></span>
{{comment.value}}
{% endfor %}
0
Vlad
Hey Vicky, have you tried like:
{{#if author.agent}}
fixed name
{{else}}
{{author.name}}
{{/if}}
0
Vicky
im trying to change the {{comment.author.name}}, if the author is an agent, it would be a fix name, but when its an end user it would be as their name on zendesk, if there a way to do it ?
0
Scott Tynan
1265703613369 MS Copilot said this about your question.
Sure, I can help with that. If you only want to include the URLs for all the attachments in public comments and not the comments themselves, you can modify your code to look like this:
This will loop through all the comments and their attachments, but only print out the URLs of the attachments. It will not print out any information about the comments themselves or any attachments without a URL. This should give you a cleaner output with only the information you want.
0
Zsa Trias
Hello Carly,
You may want to check this article on how you can customize your email template: Customizing your email templates for notifications
0
Carly Adams
Hi,
And thanks for the article.
Is there a way to pass the text so it is formatted like a ticket and not just text?
I am creating a forwarding email and would like to replicate the ticket but send it to a different requester.
0
Jed Hollander
Hi there, Aimee Spanier
Is there a way to clean up this markup
{% for comment in ticket.comments %}
Comment:
{{comment.created_at}}
{{comment.created_at_with_time}}
{{comment.author.name}}
{{comment.value}}
Attachment:
{% for attachment in comment.attachments %}
{{attachment.filename}}
{{attachment.url}}
{% endfor %}
{% endfor %}
to only include the URL's for all the attachments in public comments but not the comments? The above returns all comments without an attachment as well and I'm having trouble editing it.
Thanks!
1
Sign in to leave a comment.