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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JAVA API - get all contexts of customfield

Nir Haimov Community Leader Feb 06, 2020


We have few single select & multi select customfield with many contexts.

Each context for different projects, with different values to choose in the select drop down.


Can someone help me to find how can i get list of all contexts of a customfield?

And after getting the list, how to check for what are the options in each context?




3 answers

1 accepted

0 votes
Answer accepted

You can use FieldConfigSchemeManager and getConfigSchemeForField to get all the contexts

Then OptionsManager and getOptions to get the options in each of the Configs.

For example, in groovy:

def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName('Severity')
ComponentAccessor.fieldConfigSchemeManager.getConfigSchemesForField(cf).each{ ComponentAccessor.optionsManager.getOptions(it.oneAndOnlyConfig).collect{it.value}
Nir Haimov Community Leader Feb 09, 2020

Thank you @Peter-Dave Sheehan !

That's exactly what i needed :) 

We are requiring all the context names, relevant project name, issuetypes instead of options.

Is there any change to above script would be required ?

Also, if we need to get similar info for more than 1 field, wondering if it needs to be added next to Severity in above example ?

0 votes

For the Java API I would start at a page such as 


and check in actions.xml source file for the class that is behind that URL. Then in that class and the related jsp file, look for the Manager object that they iterate over to find each context

That lead me to the class and the method getConfigs, which has schemeManager.getConfigSchemesForField(customField);

Hi @Nir Haimov 
On my side, I am able to get every allowed values using API.
For instance, by reaching this URL : https://xxx/jra/rest/api/latest/issue/createmeta?projectKeys=MyProject&issuetypeNames=Test&expand=projects.issuetypes.fields
I get this response :Capture.PNG
You may see the highlighted lines: there are the allowed values for the customfield_11110.

Hope it helps !

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you