Hi everyone
I recently updated to ScriptRunner 4.3.9 and since then you can use some advanced scripting in the "condition and configuration" section of the listener "Send Custom Mail".
However, when I try to use "lastComment" like i usually did in my mail template, it states the variable is undeclared.
image2016-10-11 10:24:37.png
I also tried issue.lastComment, $issue.lastComment etc. No luck though.
Can somene help here?
Best Regards
Marius
Hi Marius,
I have attached a little script below which I use to get the last comment in a scripted field. You should be able to get the last comment in the same sort of way inside of your listener.
import com.atlassian.jira.component.ComponentAccessor def comments = ComponentAccessor.getCommentManager()?.getComments(issue) if (comments) { return comments.last()?.body }
I hope this helps.
Thanks
Kristian
Hey Kristian,
Thanks for that script
However, it seems like this would just return the newest comment ever made on that issue. I would like to only get the comment which was made during that transition if any has been made at all.
I use this listener for when an issue gets closed and I would like to extract the described resolution out of transition that triggered the listener.
Best Regards
Marius
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marius,
I will create a bug for this (SRJIRA-2066), you are right the comment variables are not bound and ready-to-use at the additional configuration field.
You can use them though in the email template as before , for example
Last Comment: ${lastComment} Most recent comment: ${mostRecentComment}
regards, Thanos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thanos,
Okay, cool.
Thanks to both of you for your help
Best Regards,
Marius
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.