Sabarish
Sabarish

Reputation: 531

How to get the last comment in Jira script listeners (Send custom email)

we have been using "Script Runner" plug-in to send custom emails. The below code works fine transition post function.

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

Whereas, the custom email in script listeners below line instead of the actual last comment

com.atlassian.jira.issue.comments.CommentImpl@4fexxxxx

Can you suggest a solution for this please.

Upvotes: 0

Views: 1897

Answers (2)

Navya Amberi
Navya Amberi

Reputation: 1

import com.atlassian.jira.component.ComponentAccessor
def lastcomment = ComponentAccessor.getCommentManager().getLastComment(issue)

if (lastcomment != null) {
return lastcomment.body
}

return null

Upvotes: 0

tim_yates
tim_yates

Reputation: 171194

If you look at the documentation for that class, you probably want to get the lastComment.body

Upvotes: 0

Related Questions