I've got a scriptrunner post function firing that I can't get to reliably include a comment that was created in a prior function during the same transition.
My sequence looks like:
- Adds the current user as a watcher
- Custom script post-function to add a comment to the issue (the one I want to include)
- The Resolution will be set to Done
- Set issue status to linked status
- Add a comment to the issue if one is entered during transition
- Update change history
- Re-index an issue
- Fire a Issue Resolved event
- Send a custom email
My custom email template includes:
<% if (mostRecentComment)
out << "Last comment: " << mostRecentComment
%>
I've tried mostRecentComment, lastComment, and latestPriorComment.
On rare occasion, it will seem to work, leading me to think it's a race condition. To that end, I've tried inserting another custom script post-function after step 8 that does
Thread.start {
Thread.sleep(10000)
}Any ideas what I'm doing wrong?