Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to sort comments in email automation

Catherine Parkinson October 3, 2022

I'm creating email notification for when a new comment is added under certain circumstances and am having a little trouble with the comment sort order.

I'm using the example text from this page

<b>COMMENTS</b>
{{#issue.comments}}
Comment by: {{author.displayName}} at: {{created.format("dd/MM/yyyy HH:mm a O")}}
{{body}}


However I would like it to show the most recent comment first.
How can I do this ?

3 answers

1 vote
Peter Van de Voorde
Community Champion
October 3, 2022

Hi Catherine,

have you tried {{issue.comments.reverse.body}}? 

That should return the issue's comments but in reverse order.


Cheers,
Peter

0 votes
Catherine Parkinson October 5, 2022

I updated my email text to try that and it didn't send any information in the email about each comment.

What I changed the text to:

<b>{{issue.key}}-{{issue.summary}}</b>
Link to Issue : {{issue.url}}

{{#issue.comments.reverse.body}}
<b>{{created.format("dd/MM/yyyy HH:mm a O")}}</b>
<i>{{author.displayName}}</i>
{{body}}
---
{{/}}



What it sent :
ABC-123-JIRA - Create automation for comments
Link to Issue : url_to_issue.com




---



---



I also tried without the # but then it errored and wouldn't send

Peter Van de Voorde
Community Champion
October 5, 2022

Hey Catherine can you please try

{{#issue.comments.reverse}}

<b> {{created.format("dd/MM/yyyy HH:mm a 0")}}</b>

<i>{{author.displayName}}</i>

{{body}}

---

{{/}}

Catherine Parkinson October 5, 2022

That did it !
Thank you so much :)

0 votes
Anila Noor
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 3, 2022

That should return the issue's comments but in reverse order. Which i am using as a Mepco Bill Rate. An Electricity provider

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events