Capture most recent comments on issue - entered during a transition - send email

Robb F Watkins August 10, 2018

I am trying to write a script to pull out the last comment (if there was one) during a transition - then use that to fire a custom email.  

I see in the Adaptavist Script Runner - send custom email - documentation that I should use:

issue.fields.comment.comments | last | field("body")

Just because they say I can use it does not mean I have the skills to actually use it. (brand new to coding)  

I am trying to make this (the presence of a last comment during a transition) my conditional.  So if the field is populated then send email. 

issue.fields.comment.comments.last.field.body != null      Does not work

Um can you help the new guy out?

Robb  

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Alejandro Suárez García
Atlassian Partner
August 24, 2018

Hi @Robb F Watkins 

You need to use the built "send custom email" postfunction. In the Email template box you have to put something like this:

Greetings &{issue.reporter?.displayName},

<% if (lastComment)
out << lastComment
%>

Regards,
${issue.assignee?.displayName}
Robb F Watkins August 24, 2018

Alejandro:

Thanks for the feed back.  I will test first thing Monday morning.

Robb

TAGS
AUG Leaders

Atlassian Community Events