I am trying to add checklist values programmatically through either rest api or through a groovy script but I have not had much success either way. I was looking at this How can I add or remove a option to/form the todolist via a groovy script. I was able to read values from my checklist field but I was not able to add any values. Whenever I tried to add I would get an error saying
Not a valid JSON object
I also tried to make a post request to the url used when doing an inline edit, secure/AjaxIssueAction.jspa?decorator=none as stated here https://answers.atlassian.com/questions/37036234. I would receive a status of 200 but when I check in the issue, the value has not been created. I was able to create one value in the checklist field using the JIRA REST Api endpoint for updating an issue, but I need to be able to add more than 1 and that was not working. Anyone have any idea how I can go about doing this?
There are two steps to this.
First you have to make sure that the custom field has the option (value) you want to add in the issue. So if it were a select list, you would need to maybe add a new option.
You say checklist but do you mean "radio buttons" (single select), or "checkboxes" (multiselect) or the custom "checklist" add-on field? (https://marketplace.atlassian.com/plugins/com.okapya.jira.checklist/server/overview). I'm going to assume checkboxes.
Secondly, once the new option has been added for the checkbox custom field, then you can set the value for that field in the specific issue.
Now there is no REST API to add new options to a checkbox. Annoying but there is is. But I have done it using ScriptRunner. You may even find the built-in script for adding options works for you if you have a lot of new options to add. Remember options are added in JIRA in a custom field context, so this can get fiddly but it is possible.
The second part, setting the field in the issue is possible with REST but honestly, it's easiest with ScriptRunner.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
An efficient enterprise content management system, or ECM, is a must-have for companies that create work online (cough cough, all companies). If content calendars, marketing plans, and bu...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs