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

Updating Approvers in Help Desk via ScriptRunner Cloud Edited

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:

Screen Shot 2018-02-26 at 18.35.25 PM.png

Screen Shot 2018-02-27 at 11.36.00 AM.png 

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.

 

1 answer

1 accepted

0 votes
Answer accepted

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. 

@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.

Screen Shot 2020-06-14 at 5.39.22 PM.png

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

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!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

All you wanted to know about customer support KPIs

When working in customer support, it’s crucial to calculate, analyze and monitor specific numbers, called KPIs (Key Performance Indicators). They go hand-in-hand with customer satisfaction, problem d...

107 views 1 5
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