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
4,300,974
Community Members
 
Community Events
165
Community Groups

How to assign an issue to a user using Script runner for Cloud?

Hello,

How to assign an issue to a user using Script runner for Cloud?

This used to work, but it stopped at some point:

def user = [name: "Johnt"]
issue.fields.assignee = user

Thanks

3 answers

Hi @miller j ,

  Instead of User name ,please enter user id on jira cloud,

procedure to get user id:

1.Click on user name

2.Go to tab

3.You will get an id 

 

e.g .

 

issueInput.fields.assignee = [id:'123456:12345a67-bbb1-12c3-dd45-678ee99f99g0'] as Map

 

Just one question ,

Do you know how to copy custom field value while creating new issue in jira cloud using clone post function .

Hi @cgadade ,

I tried to follow your steps, but I do not see a user name anywhere.

When I go to Settings > User Management in Jira Cloud, I get the list of all users. When I click on a user I only see Full name, Email address and Nickname.

Is the Nickname unique and non-editable?

If not, how do you uniquely reference a user in a script?

No worries, I found the accountID value in the user's URL.

Hi Miller J,

I can confirm that it is no longer possible to set a user field using a users name since Atlassian recently updated their API's to make changes to comply with the GDPR legalisation as described here.

These changes means that all user references for API's have been updated to use an accountID rather than by using a name or key.

This legislation means that Atlassian has had to update all of its rest API's in order to comply with this which mandates how data is stored.

I can confirm that we have created a page in our documentation site located here which shows how you should update your scripts to be GDPR compliant and we would advise that you review this page in order to see further details of how to set a user using an accountID and can confirm that the section located here shows how to set a user field on an issue using a users account ID.

Regards,

Kristian

Here is how I get a user by username, which you may find useful.

ApplicationUser user = ComponentAccessor.getUserManager().getUserByName("bsmith")

Hi @Payne  Is this for Jira Cloud?

I use it for server; hopefully it will work for cloud, but I'm not sure. Give it a whirl and see.

No it wont work, Cloud uses API's for scripting.

Like Jacques B likes this

Suggest an answer

Log in or Sign up to answer
TAGS

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