Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Status change history using script field

Hello, I want to extract the status change history of a specific issue into a script field. I used the code below to extract the change time and status changes, but I cannot get the user information of the person who executed this change. How can I get the information of the user who changed the status?


import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.component.ComponentAccessor;
IssueManager im = ComponentAccessor.getIssueManager()
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def created
def field
def author
def from
def to
def output = ""
def output2 = ""
for (change in changeHistoryManager.getChangeItemsForField(issue,"status"))
created = change.created
from = change.fromString
to = change.toString

output = output + from + ' > ' + to + ''' ''' +created + author + '''</br>'''
return output.replace('.0','')

1 answer

0 votes

Hi @Holtzman Ju Won Kim ,

that information is stored at ChangeHistory level and not at ChangeItemBean level.
Please take a look to the following code :

import java.util.Arrays;
import java.util.List;

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.changehistory.ChangeHistory;
import com.atlassian.jira.issue.changehistory.ChangeHistoryManager;
import com.atlassian.jira.issue.history.ChangeItemBean;

List<ChangeHistory> list = changeHistoryManager.getChangeHistories(issue);
for(ChangeHistory ch : list){
List<ChangeItemBean> listItems = ch.getChangeItemBeans();
for(ChangeItemBean ci : listItems){
created = ci.getCreated();
from = ci.getFrom();
to = ci.getTo();
author = ch.getAuthorDisplayName();



Hope this helps,


Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you