How to get list of Users an issue was assigned to.

I am trying to get the list of Users that an issue was assigned to. Below, I think I am getting the string name for the user, but I was hoping to get the User object. The getField() method seems like the best candidate for what I'm trying to extract from the history, but I'm not sure how to get the User object. Any recommendations? Thanks.

def changeHistoryManager = ComponentManager.getComponentInstanceOfType(ChangeHistoryManager.class)
def issueAssigneeHistory = changeHistoryManager.getChangeItemsForField(issue, "assignee") if (issueAssigneeHistory.size() >= 1) { assignee = issueAssigneeGroupHistory.last().getField()

1 answer

1 accepted

This widget could not be displayed.

Use UserManager. getUserByName or getUser depending on the JIRA version.

How can the assignee history be extracted by using UserManager? Thanks.

Thanks for your reply. Any ideas why userManager would be null?

UserManager userManager = ComponentManager.getComponentInstanceOfType(UserManager.class)

I've also tried:

UserManager userManager = ComponentAccessor.getUserManager()

But I get an error:

java.lang.IllegalStateException: ComponentAccessor has not been initialised.

Any ideas?

Can you try this?

def userManager = ComponentAccessor.getUserManager()

I still get the error:

java.lang.IllegalStateException: ComponentAccessor has not been initialised.

I ended up doing the following to get data associated with a username. Not sure why ComponentAccessor didn't work for me.

def componentManager = ComponentManager.instance
def test = componentManager.getUserUtil().getGroupNamesForUser(user.name)

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

290 views 5 0
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