You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!

0

Display the Latest Comment Posted by the Currently Logged In User

Overview

This is a scripted field that displays the latest comment the current user has added to the ticket.

Example

When there are multiple users working a single issue, the comments added by each user can be difficult to track. This scripted field is used to display the latest comment entered by the current user, i.e. it changes depending on which user is currently viewing the ticket.

Requirements

  • Jira Jira (8.5 - 8.22)
  • ScriptRunner for Jira ScriptRunner for Jira (8.53.0)
    
import com.atlassian.jira.component.ComponentAccessor def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def rendererManager = ComponentAccessor.rendererManager def commentManager = ComponentAccessor.commentManager def comments = commentManager.getComments(issue) def filteredComments = comments.findAll { it.authorApplicationUser == loggedInUser } if (filteredComments) { def latestComment = filteredComments.last() rendererManager.getRenderedContent('atlassian-wiki-renderer', "${latestComment.authorApplicationUser.username}\n${latestComment.body}", issue.issueRenderContext) }
Discovered an issue? Report it here

Suggested for you