Hi community,
I'd like to update a customfield (type: multiuserpicker) via ScriptRunner/HAPI
"schema": {..
"items":"user",
"custom":"com-atlassian.jira-plugin.system.customfieldtypes:multiuserpicker"
...
}
Is it possible to use something like:
def eventIssue = Issues.getByKey('ABC-123')
eventIssue.update {
setCustomFieldValue(10xxx) {
add(User1)
remove (User2)
}
}
Welcome to the community @Sven Odermatt !
You should be able to use it by adding account IDs. However, for example:
def eventIssue = Issues.getByKey('ABC-1234')
eventIssue.update {
setCustomFieldValue(10xxxx,"5b147e52xxxxxxxxxxxx")
}
Great, that did the trick, thank you
In our example, it is possible that we have more than one user in this cf.
I ended up with this piece of code to update the cf
remainingUserIdsString = remainingUserIds.join(",")
logger.info('remainingUserIdsString: ' + remainingUserIdsString)
if (updateIssue) {
logger.info('updating Issue on cf 10xxx')
eventIssue.update {
setCustomFieldValue(10xxx, remainingUserIdsString)
}
}
Maybe helpful for other newbies ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.