Which field indicates the user who last changed an issue?

Tushar Mhatre November 22, 2014

In Jira, Updated field indicated the time stamp when an issue was modified. I need to know who last modified/updated an issue. Which field indicates the user who last modified an issue?

5 answers

3 votes
Sagar Amlani August 1, 2018
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserManager

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def changeItems = changeHistoryManager.getAllChangeItems(issue)

if (changeItems?.size() > 0) {
def userManager = ComponentAccessor.getUserManager() ;
def userkey = changeItems.sort(false).last().getUserKey();
userManager.getUserByKey(userkey);
} else {
null
}

Try that! 

Julian Rdnz September 13, 2019

Works fine, thanks!

Michel_Russell February 4, 2020

Where does this code go? Sorry I am new to JIRA.

Like # people like this
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 7, 2020

This is groovy code.  In order to run this within Jira, you would need the Scriptrunner app.  There might be other differing solution from other Marketplace vendors as well.

Like Dave Liao likes this
Sylvain Leduc January 26, 2021

Hello there !

Thank you @Sagar Amlani your code worked successfully for me too ! :)

 

But it does not take into account the event "issue commented", only updates to the ticket.

If someone comments the ticket, the last updater will not change, if you understand what i mean.

 

How to implement the "issue commented" also please ?

 

Sylvain

1 vote
Hailin Zhang September 24, 2018

Here is an exampled script using Powerscript.

Add post function to all transitions of workflow and do bulk transition.

JFieldChange [] changes = lastIssueChanges(key);

number i = size(changes) -1;

if (i >= 0){

string fullname = ldapUserRecord("displayName", "(sAMAccountName=" + changes[i].user + ")");

string lastupdatedby = changes[i].user;

if (fullname != ""){

lastupdatedby = fullname + " (" + lastupdatedby + ")";

}

customfield_39271 = lastupdatedby; //Last updated by

}

1 vote
Norman Abramovitz
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.
November 23, 2014
0 votes
Gregory J. Murphy October 25, 2018

I don't know how or where to use either of the script suggestions above. Can you provide more detail? Or, can someone suggest how to achieve this with Power BI?

0 votes
Norman Abramovitz
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.
November 22, 2014

Unfortunately, JIRA does not have one.   You can vote for these issues to attempt to get JIRA fixed.

https://jira.atlassian.com/browse/JRA-1973

https://jira.atlassian.com/browse/JRA-15235

You can use the changed or was operators on the assignee, fixed version, priority, reporter, resolution and status fields though.

status changed after -5d by George

 

There are some free and paid plugins to help with comments like

https://marketplace.atlassian.com/plugins/com.capitalcityconsultants.jira.plugins.customfields.ccc-lastcomment

https://ecosystem.atlassian.net/wiki/display/JTOOL/JIRA+Toolkit+Plugin

https://marketplace.atlassian.com/plugins/com.primefieldsoftware.jira.essentialcustomfields

Suggest an answer

Log in or Sign up to answer