New comment in custom email body (Script Runner, built-in script 'Send custom email')


I need advice.

I use built-in script "Send custom email":

Event: Issue commented

Condition: issue.status?.name == 'New'

Subject template: Issue $issue was commented

How can I paste new comment in 'Email Template'?

5 answers

1 accepted

1 votes

Thanks for finding that Daniel... however I think that will fall over when there are no comments.

I have updated the sample template in (Point 3).

Make sure you use the if, or if you don't, at least test it with an issue with and without comments in builtin scripts -> Send a custom mail (which is used for testing templates).

I like this template, thanks :)


How do you get the comment of the last transition - if any.
lastComment is set, even if the transition didn't have any comment,
so containing a comment which is not relevant to the transition.


Yeah... that's no good is it. Can you create a bug, I will try to fix. I don't think the email template has access to transientVars or event, to get the comment added on that transition.

And the event if it's a listener, but yes indeed. Thanks for the issue.

Hi @Jamie Echlin [Adaptavist], how can I get, in a custom email template, the transition's comment author? Thank you in advance Arianna

It will be:

Hi @Jamie Echlin [Adaptavist] , if I use <% out << %> I get, on preview, No such property: comment for class: groovy.lang.Binding Any suggestion? Thank you again


simply adding the line:


should "paste" the new comment into the email.

You should check for more info.

no result :(

this listener works if i paste some constant text, but with this line - no

Sorry, it wasn't as simple as I thought.


&lt;% out &lt;&lt; componentManager.commentManager.getComments(issue)?.last()?.body %&gt;

Found the answer in this comment.

yeeeeeah :)


Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,816 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot