Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JIRA cloud scriptrunner workflow post function: set user picker value for custom field

I have a custom field that is type user picker, and I am trying to update the user associated with this field on issue creation. However, I have not been able to assign the user picker field. 

In the below example, my logged output shows that "updated user: 'jdoe'" but this change is not reflected on the JIRA ticket.

def username = "jdoe"

issueInput.fields.customfield_16400 = [name: username]
logger.info("updated user: " + issueInput.fields.customfield_16400)

What type does the custom field for user picker expect, and how do I go about updating it?

Please note that I use JIRA Cloud.

2 answers

1 accepted

1 vote
Answer accepted

Hi Samuel,

Thank you for your question.

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.

If this answer has solved your issue can you please accept it in order to mark this answer as correct for users who are searching for a similar issue.

Regards,

Kristian

User accounid as the value when using Update Issue Custom Field.

How to get accountid:

https://[domain name].atlassian.net/rest/api/latest/user/search?query=[user email]

In the return string, which looks like this, you can spot the accountid:

[{"self":"https://[domain name].atlassian.net/rest/api/2/user?accountId=557058:1991c146-4646-43d3-98d0-xxx","key":"admin","accountId":"557058:1991c146-4646-43d3-98d0-xxx","accountType":"atlassian","name":"admin","emailAddress":"[user email]","avatarUrls":{"48x48":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:1991c146-4646-43d3-98d0-xxx/97b461af-8916-411e-a2a1-1f6e5e89adc7/128?size=48&s=48","24x24":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:1991c146-4646-43d3-98d0-4b72ee11f382/97b461af-8916-411e-a2a1-1f6e5e89adc7/128?size=24&s=24","16x16":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:1991c146-4646-43d3-98d0-xxx/97b461af-8916-411e-a2a1-1f6e5e89adc7/128?size=16&s=16","32x32":"https://avatar-management--avatars.us-west-2.prod.public.atl-paas.net/557058:1991c146-4646-43d3-98d0-xxx/97b461af-8916-411e-a2a1-1f6e5e89adc7/128?size=32&s=32"},"displayName":"user full name","active":true,"timeZone":"Europe/Berlin","locale":"en_US"}]

Hi, could you advise the code about how to get accountId from the return string in Scriprunner?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

New Cloud Apps Roundup - April 2021

Atlassian's marketplace partners have had a very productive start to 2021! Since our last roundup, our developer community has added over 160 new cloud apps to the Atlassian Marketplace to help you...

289 views 3 20
Read article

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