Show Last Comment for an Issue

Overview

This script highlights the last comment posted on an issue in a script field.

Example

As a developer working on a new project with a large number of issues, I must ensure I'm working with the most up-to-date information. Therefore, it's useful to have the latest comment highlighted, so I don't have to spend time navigating the comment history and potentially work from out of date information. Using this script, I can display the most recent comment in a script field where it is easily visible.

Good to Know

  • (Server) Use 'Text Field (Multi-line)' as the template for the custom script field and 'Free Text Searcher' as the searcher.
  • (Cloud) Custom field is created as 'Text Field (single line)' and script is added as a listener for 'Comment Created' event.

Requirements

Jira Jira (7.7 - 8.6)

    
import com.atlassian.jira.component.ComponentAccessor def commentManager = ComponentAccessor.commentManager def comment = commentManager.getLastComment(issue) if (comment) { comment.body }
Discovered an issue? Report it here

Suggested for you