How to get assignee change history?

New issue has the assignee field set to "automatic" for default value. How can I obtain the "assign date" value for usage as a value in a scriptrunner(scripted field) to track when time is changed.

2 answers

1 vote

You need to use com.atlassian.jira.issue.changehistory.ChangeHistoryManager. Google on that, you should find some examples.

Thank Jamie. I found an example and I am able to get the assignee change history with the following scripts.

import com.atlassian.jira.issue.*
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.core.util.DateUtils 
import com.atlassian.jira.ComponentManager 
import com.atlassian.jira.issue.history.ChangeItemBean 

def componentManager = ComponentManager.getInstance();
def changeHistoryManager = componentManager.getChangeHistoryManager();

def changeItems = changeHistoryManager.getChangeItemsForField(issue, "assignee");
def firstAssigned;
if(changeItems !=null && !changeItems.isEmpty()){
	ChangeItemBean ci = (ChangeItemBean) changeItems.get(0);
	String assigneeName = ci.getFrom(); // name
	String assigneeFullName = ci.getFromString();// full name
        def assignedTime = ci.getCreated().getTime();
        firstAssigned = assignedTime;

}

Is there a possibility to get the user who did the transition?

I also would be very interested

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

134 views 0 3
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you