Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
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

Unable to update multi-user list using the API

I am trying to set a multi-user field using the API - I am running this from the ScriptRunner console, but I don't think this is a ScriptRunner issue.

My code is as follows:

put("/rest/api/3/issue/AB-123")
.header("Content-Type", "application/json")
.body([
fields:[
customfield_11018 : [{id:"<my user id>"}],
assignee: [id: "<my user id>"]
]
])
.asString()

customfield_11018 is a multi-user field, and assignee is a single user field.

When I run this script, there are no errors produced.  The assignee is correctly updated, but the multi-user field is set to blank.

Am I doing something wrong, or is this a bug?

2 answers

1 accepted

1 vote
Answer accepted

Thank you.  So the answer is:

put("/rest/api/3/issue/AB-123")
.header("Content-Type", "application/json")
.body([
fields:[
customfield_11018 : [[id:"<my user id>"]],
assignee: [id: "<my user id>"]
]
])
.asString()

Hi Nick,

Thank you for your question.

I can confirm that we have an example snippet located here which shows how to set different type of user picker fields with ScriptRunner for Jira Cloud.

Inside this snippet, we show how to set a multi-user picker custom field which requires you to pass an array for each user to be set as a comma-separated list and you can use this example as a reference guide to help you create the script which you require.

I hope this information helps.

Regards,

Kristian

Are you able to explain why the documentation says to use curly brackets?:

"customfield_11458" : [ { "name":"inigomontoya" }, { "name":"tommytomtomahawk" }]

See: https://developer.atlassian.com/cloud/jira/service-desk/rest/#fieldformats 

Is this difference to do with ScriptRunner?

Hi Nick, 

Thank you for confirming that the example which we have provided you have resolved your issue and has allowed you to resolve your issues

I notice that page is from the Jira Service Desk rest API's and is only relevant to Jira Service desk and is not valid for Jira Core or Jira Server projects which are example is based on. 

I would advise contacting Atlassian to check if that example in that documentation link is still valid.

Regards,

Kristian

I think that the documentation is correct.  It is because the script is written in Groovy, which substitutes {} for [].  In Groovy, {} is reserved for Closures.

Hi Nick,

Thank you for confirming this and for confirming that your issue has been resolved.

Regards,

Kristian

@Nick Hassell 

Is there any way to use name?!

customfield_10003 : [["name":"firstname secondname"]] or customfield_10003 : [[name:"firstname secondname"]] - did not work

Hi Andrey,

I can confirm that you cannot use a user's name inside of Jira Cloud as Atlassian only allows you to specify users via their accountId since the GDPR changes they made and they enforce this in the rest API's which means you cannot specify users via their username.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

314 views 9 7
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