how to display customfield options(dropdown values) if it does not have any context associated

Tushar Wagh April 9, 2023

customfield_15000 does not have any context associated and I want to display all dropdowns present for the same custom field but as I do not have context id I am not able to use below rest api.

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

 

and when tried to get the custom fields options using below link I am getting 405 as method not allowed

/rest/api/latest/customFieldOption?fieldId=customfield_15000

1 answer

0 votes
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2023

Hi @Tushar Wagh 

WHat do you mean by there is no context associated with the custom field? If you have deleted the context, then you can't have any values on that CF. Can you post a screenshot of your custom field? Cog wheel > issues > custom fields > find you custom field and click "context and default value"

Tushar Wagh April 10, 2023

I guess that custom field will be having a global context assigned but I want that context id so that I can use the below API to display the values for customfield.

 

GET /rest/api/3/customField/customfield_15000/context/{contextId}/option

 

Just to let you know that I do not have UI access and just have the programmatic access.

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2023

Try this then 

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

and see all available contexts. Then get the corresponding ID:

context id.png

Like Jawann Swislow likes this
Tushar Wagh April 10, 2023

Yes tried the same but getting the same error as below

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status>
<status-code>404</status-code>
</status>
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2023

Are you on cloud or on premise? From the request you sent it seems to me that you are on premise and not on cloud.

Tushar Wagh April 10, 2023

I am using my local pc.

Working fine when displaying the tickets using below URL but just not working for context.

/rest/api/latest/issue/MCC-1023940

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2023

The api you are using, and the one I provided, are for the cloud version of jira, and not for on premise.

Tushar Wagh April 10, 2023

then for on premise which one I can use ?

Is there any API document available on the same ?

Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2023

Here you'll find the rest api for server https://docs.atlassian.com/software/jira/docs/api/REST/9.7.0/

Tushar Wagh April 10, 2023

Thanks for the help @Alex Koxaras _Relational_ 

I am using below API from above document and it is giving me 404 not found error.

GET /rest/api/2/customFields/{customFieldId}/options

 

Error:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status>
<status-code>404</status-code>
</status>
Alex Koxaras _Relational_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2023

What is your server version @Tushar Wagh ? 

Suggest an answer

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

Atlassian Community Events