Script runner custom email

Hi, I have been successfully using below text in the email body and it was working fine in Jira 6.2.7.

It successfully sends out the last comment. however it is not working in Jira 6.3.1 and latest script runner.

<% if (lastComment)
out << "Comment: " << lastComment
%>

In Jira 6.3.1, it sends out something like below and not the actual comment. Can anyone please help me with correct syntax?

Comment: com.atlassian.jira.issue.comments.CommentImpl@78174905

Thanks for your help!

Rama

2 answers

1 accepted

0 vote

Sorry, I think that's a new bug I introduced. It's trivial to fix, will release shortly.

In the meantime you might want to check https://jamieechlin.atlassian.net/wiki/display/GRV/Built-in%20Scripts#Built-InScripts-CommentsinEmailsto see if you really want lastComment.

Cedric's workaround should work - what is the result when you use that? I don't really recommend using it because it will break again when I release the fix.

Ref: https://jamieechlin.atlassian.net/browse/GRV-507

Thanks Jamie!

I have a requirement to email comment made during a specific transition. If no comment was made during that transition, no comment should be added added to email body.

In script runner version 2.1.17, it works fine when the comment is added during the transition. But looks like if no comment is added then most recent comment is sent out. Any idea how to avoid it?

I tried cedric's workaround but I did not send out any email. I don't see any errors in the log files as well.

Thanks for your help!

Just a guess, but try

out &lt;&lt; "Comment: " &lt;&lt; lastComment.getBody()

Thanks Cedric! But looks like it is not working either

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

168 views 0 4
Read article

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