Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Scriptrunner Assignee History in a Scripted Field


Assignment history is extremely important to my customer. For some obvious transparency and traceability reasons this is something they want to be able to track. In the past, I've created various "position/title" user picker fields, but that doesn't quite fit the desired functionality. 

Then I saw this in the Adaptavist Library: Show Assignee History on Issue Details Page 

I wish I had a screenshot to show what the ScriptRunner script fragment produces, but this is what it resembles (Credit: PowerPoint Magic): 


This script is great! My customer LOVES the simplistic solution.

The down-side to having the script fragment (for my customer) is the following:

  1. It cannot back-date... all precluding history changes are not captured so for pre-existing projects, the assignee history is incomplete.
    • I assume this has to do with the fragment acting like a counter for a specific event.
    • This leads me to concerns about how this information is retained, and what would happen if the system crashed, how is the data stored, and how taxing is it on the system memory? 
  2.  There is no simple way to query against the data as a script-fragment. 
    •  At least not for the average user, I'm sure you can with JQL functions. 
  3.  There is no way to aggregate or export the values.
    •  Script-fragments don't export, not even when exporting to print. 

It's got me wanting to aggregate this in a scripted field... 

Problem is...

  • First, I'm not sure what the most efficient and sustainable way to do this is, AND
  • Second, I'm not sure how to modify the script to have it append the assignee history in a scripted field. 
  •  I think it might be accomplished with a listener and scripted-field combination.
  • I'm also concerned about having multiple values, and how to keep them separate, and meet the customer needs (let's be honest, "wants") listed above. 

I'm open to suggestions, but I am limited within my strict environment. Buying a new add-on(s) is not an option till next FY quarter (if then). 


I have a feeling, someone in the community has this same ask/question, and I think it could be accomplished in several ways. I'm about to go down this rabbit-hole, but if anyone has suggestions or has already come up with this solution, I'd be extremely grateful!

1 comment

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.
Dec 16, 2019

Hi, I tried the Show Assignee History on Issue Details Page script and it only shows me the previous assignee and not a list of all the assignees. How did you make the whole list appear?

@Z B, That is the first of my listed concerns above. The list generated from the script-fragment does not back-date. Where you set the limit in the code is shown in the image attached below, but it only captures assignee history from the moment you apply the script-fragment. I assume you can change the limit to include more than 5, and I have not tested it to see how many can be listed before the list becomes excessive.


As far as to how I did it in my original post... I do not have a Jira environment on this network, so I created the reference image out of various images I found by performing a internet search and splicing them together (via PowerPoint) to resemble what it looks like on my production environment. 

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.
Dec 17, 2019

Thanks for the explanation, I understand the question better now.

I was trying to rewrite the table part with StringBuilder builder=new StringBuilder() based on what I found in 

but I'm getting an error for the 29th line: expecting: ':', found: ')' - This is the last ) in the line, I guess.

Do you know how the table could be put into html, or any ideas? My idea was to try to append the new list elements so that the old once wouldn't disappear.

import com.atlassian.jira.avatar.AvatarService
import com.atlassian.jira.component.ComponentAccessor
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 = 50

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()
StringBuilder builder=new StringBuilder()
builder.append('<tr><td style="width: 90px;">'+date.format(format)+'</td><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=$'"><span class="aui-avatar aui-avatar-small"><span class="aui-avatar-inner"><img src="'+avatarService.getAvatarURL(loggedInUser, user)+'"></span></span></td><td>'+user.displayName+'</td></tr>')
/*tr {
style: "width: 90px;", date.format(format)
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=$"
) {
class: "aui-avatar aui-avatar-small"
) {
class: "aui-avatar-inner"
) {
src: avatarService.getAvatarURL(loggedInUser, user),

Like Mariusz Piotrowski likes this
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.
Dec 17, 2019

Also, I changed the final int historyDepth = 50 part and that didn't change anything.


Log in or Sign up to comment