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
Trying to update the default approver field that comes with Help Desk. For my instance of JIRA Cloud the custom field is 'customfield_10029'. I attached a screenshot of the structure and my script listener below. The script listener isn't throwing any errors but it isn't setting the approver field either. I've tried the same script with another user pick list and it works as intended. Would definitely like to leverage the "Approver" field instead of another user pick list.
I thought I was matching the structure of the custom fields properly, but when the script is triggered the approver field isn't being set properly.
How can I properly set the approver field via scriptrunner?
Thanks!
Structure of customfields:
Script Listener:
def approverID = 'customfield_10029'
def approvalsID = 'customfield_10015'
def userApprover = ""
def value1 = issue.fields.customfield_16125.value as String
if (value1 == "Santa Claus"){
userApprover = "santa"
} else {
userApprover = "joe"
}
put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.body([
fields:[
(approverID):[{
name: userApprover
}],
(approvalsID): [{
canAnswerApproval: true
approvers: [{
approver:{
name: userApprover
}
}]
}]
]
])
.asString()
Edit: Realized that a second custom field is attached the approver field for helpdesk.
Hi Ryan,
Unfortunately the Approvers field is a locked field owned by the Jira Service Desk.
Service desk fields need to be updated using the Jira Service Desk Cloud Rest API located here, however unfortunately there is no rest call provided to update the Approvers field which means that it cannot be set using ScriptRunner for Jira Cloud.
Thanks
Kristian
Thanks Kristian,
Appreciate the help!
For those that run into a similar problem, as a workaround I created a custom user picker field. Set that user field for the approver at the step in the workflow and setting the value with Scriptrunner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ryan Yoshioka
What is the structure to be used to update a User Picker field?
I am a new user and I am I little confuse how to update it.
I am using the structure below for testing, the reporter I was able to set the user by using the AccountID field, but for the CF customfield_11410 it is removing the user and leaving it blank.
My goal is to be able to add multiple users inside a multiple user picker custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joao,
I can confirm we have an example script located here which can be run on the Script Console as the ScriptRunner add on user and shows how to set a Multi User Picker field by passing the array of users account ID's and you will be able to use this script as a reference guide to help you create the script that you require.
I hope this information helps.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems that the example above does not work for setting the Approver inside of Service Desk. Is there still no way to do this in jira cloud?
Thanks!
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.