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

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 Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

288 views 38 9
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot