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

How to set value for single select custom field with REST API?

Philip Colmer
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.
June 19, 2023

The "editmeta" response for a given issue includes this definition for one of the custom fields:

        "customfield_10166": {
            "required": false,
            "schema": {
                "type": "option",
                "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
                "customId": 10166
            },
            "name": "Engineer Type",
            "key": "customfield_10166",
            "operations": [
                "set"
            ],
            "allowedValues": [
               {
                    "self": "https://linaro-development.atlassian.net/rest/api/3/customFieldOption/10331",
                    "value": "Assignee",
                    "id": "10331"
                },
                {
                    "self": "https://linaro-development.atlassian.net/rest/api/3/customFieldOption/10332",
                    "value": "Member",
                    "id": "10332"
                },
                {
                    "self": "https://linaro-development.atlassian.net/rest/api/3/customFieldOption/10333",
                    "value": "Affiliate",
                    "id": "10333"
                }
            ]
        }

If I try to set this field (e.g. with PUT /rest/api/latest/issue/<key>) on an issue with this body:

 

{
    "fields": {
        "customfield_10166""Affiliate"
    }
}
it fails with this error: Specify a valid 'id' or 'name' for Engineer Type
I've tried the alternative format of specifying a value (using "update" instead of "fields") but I get the same error.
What am I doing wrong, please?

3 answers

1 accepted

4 votes
Answer accepted
Rudy Holtkamp
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 19, 2023

Use this:

{
"fields": {
"customfield_10166": { "value": "Affiliate"}
  }
}
1 vote
Yatish Madhav
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.
June 19, 2023

This should help you https://community.atlassian.com/t5/Jira-Service-Management/Trying-to-edit-select-field-with-Value-not-ID/qaq-p/2153992

if the field is field created in Jira UI, it will help you. If the field is a custom connect add on field, you will not be able to set it using the value but only with the ID (still looking for a solution for that myself)

Hope it helps/works for you.

0 votes
Rudy Holtkamp
Contributor
June 19, 2023

.

Suggest an answer

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

Atlassian Community Events