Groovy : update issue reporter with are particular user

I have a user given to me via a request from and I want to use groovy to update the report. I worked out how to locate the user object from searching the user's ID number. (Jira links into our companies Active Directory).


def userName = "U00001"
	def userObject = ComponentAccessor.getUserManager().getUserByName(userName)

The object consists of these elements:



2017-04-11 12:29:29,737 WARN [runner.ScriptRunnerImpl]: key = u00001
2017-04-11 12:29:29,737 WARN [runner.ScriptRunnerImpl]: directoryId = 10000
2017-04-11 12:29:29,737 WARN [runner.ScriptRunnerImpl]: directoryUser = U00001:10000
2017-04-11 12:29:29,737 WARN [runner.ScriptRunnerImpl]: emailAddress =
2017-04-11 12:29:29,737 WARN [runner.ScriptRunnerImpl]: username = U00001
2017-04-11 12:29:29,737 WARN [runner.ScriptRunnerImpl]: name = U00001
2017-04-11 12:29:29,737 WARN [runner.ScriptRunnerImpl]: displayName = SURNAME, Samuel


Now I can't work out how to set the reporter to this user object.

I have tried this code but it just update's the field and I can see jira does not see it as a user. It's just text sitting in the report field. 

issue.reporterId = userObject.displayName

I took this idea from this post. I tried the same method in the answer and set the current logged in user as the repoter, but jira still doesn't see it as a user object.

issue.reporterId = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser().name


1 answer

This widget could not be displayed.

Just worked it out. This may be unique to my situation as my Jira is integrated with Active Directory.

I used .key

def userName = "U000001"
def userObject = ComponentAccessor.getUserManager().getUserByName(userName)
issue.reporterId = userObject.key



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 11 hours ago in Canada

AUG Lunch Roundtable - August 13 - Highlights

Thanks to everyone who came out today for the lunch AUG - we had some great food and discussion (and ice cream sandwiches to fend off the heat!) The welcome and fun fact was great as well, what an aw...

27 views 1 3
View post

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