Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ScriptRunner: Last shared comment on issue

Joseph Hortch July 20, 2021

Hi, 

I am using the code below but I am having a hard time finding understanding how JIRA is separating comments by internal vs shared.  Any suggestions? 

/**
* Field name: LastComment
* Template: Text Field (multi-line)
*
* Description:
* Returns the last comment on an issue.
*
*/

import com.atlassian.jira.component.ComponentAccessor

 

// get the latest comment
def commentManager = ComponentAccessor.getCommentManager()
def comment = commentManager.getLastComment(issue)

// check to see if comments exist - return comment body if so
if (comment != null) {
return comment.body
}

return null

1 answer

0 votes
Ivan Lima
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2021

Hi @Joseph Hortch, you can get some insights into that through the Adaptavist Library script below. Have a look.

https://library.adaptavist.com/entity/get-the-visibility-of-new-comments-in-jira-service-desk

Joseph Hortch July 20, 2021

Hi Ivan, 

Thank you.  I will take a look. 

Suggest an answer

Log in or Sign up to answer