Show Assignee History on Issue Details Page

Use a ScriptRunner Web Panel to display a record of all users who were assigned to the issue.

  • Location: atl.jira.view.issue.right.context

Requirements

Jira Jira (7.7 - 8.6)

    
import com.atlassian.jira.avatar.AvatarService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.config.properties.APKeys import com.atlassian.jira.issue.Issue import groovy.xml.MarkupBuilder import java.time.format.DateTimeFormatter import static com.atlassian.jira.issue.IssueFieldConstants.ASSIGNEE // the upper limited on the assignees to be displayed final int historyDepth = 5 def issue = context.issue as Issue def counter = 0 def baseUrl = ComponentAccessor.applicationProperties.getString(APKeys.JIRA_BASEURL) def avatarService = ComponentAccessor.getComponent(AvatarService) def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser new MarkupBuilder(writer).table { ComponentAccessor.changeHistoryManager.getChangeHistories(issue).reverseEach { def changeItems = it.changeItems if (changeItems.field.first() == ASSIGNEE && changeItems.newstring.first() && counter < historyDepth) { def user = ComponentAccessor.userManager.getUserByName(changeItems.newvalue[0] as String) def format = DateTimeFormatter.ofPattern("dd/MMM/yyyy") def date = it.timePerformed.toLocalDateTime().toLocalDate() tr { td( style: "width: 90px;", date.format(format) ) td( class: "jira-user-name user-hover jira-user-avatar jira-user-avatar-small", rel : "admin", "id": "project-vignette_admin", style: "margin: 1px 0px 1px 0px; height: 24px;", href : "$baseUrl/secure/ViewProfile.jspa?name=$user.name" ) { span( class: "aui-avatar aui-avatar-small" ) { span( class: "aui-avatar-inner" ) { img( src: avatarService.getAvatarURL(loggedInUser, user), alt: user.name ) } } } td( user.displayName ) } } counter++ } }
Discovered an issue? Report it here

Suggested for you