Forums

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

Get Multiple Comments displayed on separate lines in automated email

Zachary Johnston May 25, 2022

I want to have each comment made within an Issue to be displayed in an automated email with each comment on it's own line for readability, but don't know what to place to give line breaks.

This is what I have written for automating an email when condition is met:

Project: {{project.name}}

Issue Key: <a href="https://skdyproductexperience.atlassian.net//browse/TE">({{issue.key}})</a>
Status: {{issue.status.name}}
Description Summary:
{{description}}
Comment Body:
{{issue.comments.body}}

where each comment in the issue for test purposes:

1, 22, 333, 4444, 55555, 666666

and it results in:

Project: x-xx

Issue Key: (xx-xx)
Status: To Do
Description Summary:
i wrote this description here
Comment Body:
122333444455555666666

Desired result:

1

22

333 etc.

1 answer

1 accepted

1 vote
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 27, 2022

Hi Zachary,

This is possible to do with some of automation smart values.  Specifically see the examples in Jira smart values - lists.  Automation will need to treat those comments like they were a list for this to work.

Try changing your Comment Body: line value to be:

Comment Body:
{{#issue.comments}}{{body}}{{^last}},

{{/}}{{/}}

 

This will add a comma, and then 2 carriage returns after all the comments except for the last comment.  Of course, you could remove the comma if you like, but this approach should be able to format that email in the way I think you are looking for here.

Andy

Zachary Johnston May 31, 2022

Thanks Andy!

Like Andy Heinzer likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events