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.
- I have a call to retrieve the group members' account IDs (working)
- Using collect to format the list of account IDs to make it API call ready (?)
- The edit/put call is working when values are manually typed in (working)
- Error when executing the script -- "errors":{"customfield_xxxxx":"expected Object"}}
- I suspect that my issue is with how I am formatting the list of account IDs, but I do not know of any alternatives.
---
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!