Display the Last Comment for JIRA issues

  • Post author:
  • Post category:Blog
  • Post comments:2 Comments
  • Reading time:2 mins read


  • In JIRA we can add multiple comments for one issue but we cannot view those comments in the issues navigator due to the comment field is not available to display in the JQL search.
  • You want to see the last comment for issues returned by your query


We can resolve the problem by using the Adaptavist ScriptRunner Custom field as below

  • Go to JIRA Administration | Manage apps | ScriptRunner | Fields
  • In the Script Fields screen click on the Create Script Field button then Custom Script Field selection on the next screen
  • In the Custom Script Field providing enough info and add the following script
* Field name: Last Comment
* 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

The final as picture below


This Post Has 2 Comments

  1. Gurmeet Singh

    Wow !! This thing works. HIghly recommended.

  2. php patterns

    Hello friends, fastidious piece oof writing and pleasant urging commented
    at this place, I am really enjoying by these.

    php patterns

Leave a Reply