Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Body for Checkbox set value in Jira Rest API with POST in Scriptrunner is not valid object

Edited

So I'm trying to set checkbox values using script runner specifically Script Listener.

This is the code I'm trying to execute

 put("/rest/api/2/issue/${issueKey}")
.header('Content-Type', 'application/json')
.body([
fields: [
"customfield_10036": [
[["value": "ALL"], ["value": "BT7"], ["value": "MACS"], ["value": "SPINS"], ["value": "BT4"], ["value": "NGB30"], ["value": "NG7S"]]
]
]
]).asString()

However for some reason, I get this error

body: {"errorMessages":[],"errors":{"Instrument":"The Instrument value must be an object"}}

 

How the value not an object.

Thank you

1 answer

1 accepted

4 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 27, 2023

Hi Fawaz,

I can confirm we have an example script that can be run  on the script console that shows how to set a checkbox field here.

You will be able to use this script to help write the rest API call neeed to set the checkbox values via a script listener.

I hope this helps.

Regards,

Kristian

Robert Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 27, 2023

Just to add, the only issue with your call @Fawaz Joseph is you have 1 too many sets of brackets, 

 

[["value": "ALL"] <- all your other options -> ["value": "NG7S"]]


Should become:

["value": "ALL"] <- all your other options -> ["value": "NG7S"]

Thank you @Robert Bailey 

This fixed my problem

Thank you for the snippet @Kristian Walker _Adaptavist_ 

This will be very useful going foward

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 30, 2023

Hi Fawaz,

You are welcome, and I am glad we managed to help you to achieve your requirement.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
AUG Leaders

Atlassian Community Events