How to update a checklist custom field and check off desired values?

Alex Atkinson September 9, 2022

Hello,

I am trying to update my custom field checklist using REST API and check off the desired values according to a specific selected value id. I've looked at documentation and don't get any errors in with my Python JSON format, but it does not check off anything in my checklist or update my issue at all.

 

checklist field ID: 10117

selectedValueID: 10224

 

Here's my Python code:

 

"update": {
  "fields": {
    "customfield_10117" : [
          {
               "set": [
                      {
                           "name": "Print welcome packet.",
                           "checked": "true",
                           "mandatory": "false",
                           "option": "true",
                           "id": "10224"
                        }
                  ]
             }
         ]
     },
}

 

1 answer

0 votes
Maxime Lefebvre _Okapya_
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.
September 12, 2022

Hi Alex,

The format of the data looks like our "Checklist for Jira" Server/DC REST format, albeit from an older version (v4), because "option" is no longer a valid property.

Your post indicates you are on Cloud, so I am not sure which App and which Jira install you are using.

Here's some information that could help:

- Up to date documentation for Checklist for Jira (Server/DC).

- If you are using Checklist for Jira on Cloud, unfortunately there is no REST API to update the value at the moment.

- If you are using Issue Checklist on Cloud, here's the documentation for it.

Let me know if this helps!

Have a nice day

Alex Atkinson September 13, 2022

Thanks! Actually, "option" was not the problem. My issue was not updating for a few reason:

1. When having "update" it did not work, so remove it.

2. "Set" also seemed to be an issue, so removing it worked.

3. "Mandatory" was checked "false", which tells Jira it is not necessary to update.

Once I removed these in my JSON, everything updated.

Maxime Lefebvre _Okapya_
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.
September 13, 2022

Good to see it worked out :)

After taking a closer look, I see why you had to remove "update" and "set", because it's synonym to "fields".

When using Jira REST API, you either use "update" or "fields", not both at the same time.

"fields" is a shortcut for doing an "update" with "set" operation. Example:

"fields": {
"my-field": "value"
}

is the same as doing:

"update": {
"my-field": [
{
"set": "value"
}
]

The "update" method becomes interesting if you want to do something else than "set", which overwrites the field value completely. If you wanted to add a value to the existing value, you would do:

"update": {
"my-field": [
{
"add": "value"
}
]
}

 Have a nice day!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events