Display last internal comment with Script Runner

Ryan_McAlevey September 16, 2019

I'm attempting to show the last internal comment on a customer scripted field using Script Runner. I'm using the following script which returns the last comment, however it does not filter out external comments added via the portal. Is there a way to exclude external comments?

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.comments.CommentManager

import com.atlassian.jira.component.ComponentAccessor

def commentManager = ComponentAccessor.getCommentManager()

def comment = commentManager.getLastComment (issue)

comment.body + " Author: " + comment.authorFullName

 

0 answers

Suggest an answer

Log in or Sign up to answer