Non-Global Custom Fields, i do i get the options for those fields, i checked the API but it require context id, which i dont know

i am building the Jira plugin where i want to show the list of options defined in the custom field of an issue. 2 fields actually, Screens & Features. i cant see them in list of them in Jira setting i see other custom fields but not these because its added i thing from Jira issue type.

i see my those custom field in this API rest/api/3/field but when i try get their options with API /customField/{id}/option, i get error message Global context does not exist for the field 10034. .

i also got other API rest/api/3/field/:fieldId/context/:contextId/option and i have to pass context id as well in order to get value of this, but i donk know how to get the context id for these fields.

Hi,

If you have an issue, you may try this one:
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-editmeta-get
It should give you the allowed options for a customfield

Hi Hamza,

I am Rehes. I’m happy to help you with your question about getting options for non-global custom fields in Jira.

The APIendpoint /customField/{id}/option requires a global context ID, but non-global custom fields don’t have global context IDs. To get the options for a non-global custom field, you need to use the API endpoint /field/{fieldId}/context/{contextId}/option.

To get the context ID for a non-global custom field, you can use the API endpoint /field/{fieldId}/context. This endpoint returns a list of all the contexts in which the custom field is used. The context ID is the value of the id property in the response JSON.

Once you have the context ID, you can use it to get the options for the custom field using the API endpoint /field/{fieldId}/context/{contextId}/option. This is what I learn from them in my time span.

Here is an example of how to use the API to get the options for a non-global custom field:

# Get the context ID for the custom field

GET /rest/api/3/field/{fieldId}/context

# Get the options for the custom field using the context ID

GET /rest/api/3/field/{fieldId}/context/{contextId}/option

I hope this helps! Please let me know if you have any other questions.

Best regards,

Rehes

1 Like

thanks for you reply, but @RehesRarba i did try as well getting the context id as you mentioned above, but again i got some error saying field doesn’t exist or invalid id.

i have solved my issue by creating the global custom fields but not sure if its right for my Jira Custom UI App or not.