You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi community,
I am using Scriptrunner Cloud to attempt to retrieve the members of a Jira group (group1), and write those users to a multi user picker custom field.
---
def gusers = get("/rest/api/3/group/member?groupname=group1")
.header("Content-Type", "application/json")
.asObject(Map)
def accountdetails = gusers.body.values as List<Map>
def accountids = accountdetails.accountId
def modaccountids = accountids.collect{'["id":' + '"' + it + '"]'}
print(modaccountids)
//api call
put("/rest/api/3/issue/ABC-123")
.header("Content-Type", "application/json")
.queryString("overrideScreenSecurity", Boolean.TRUE)
.body([
"fields": [
"customfield_xxxxx": [
modaccountids
]
]
])
.asString()
Any help would be greatly appreciated!
Hi community,
After a few more cycles, I was able to resolve this issue. In my original post, I thought my issue was related to the way formatting the list of account IDs, and that did turn out to indeed be the issue. Here is how I resolved it...
Original: def modaccountids = accountids.collect{'["id":' + '"' + it + '"]'}
Updated: def idList = accountids.collect { item -> ["id": item] }
Hopefully this can help the community at some point in the future. Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.