Hi,
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?
Thanks,
Nir
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{
log.info ComponentAccessor.optionsManager.getOptions(it.oneAndOnlyConfig).collect{it.value}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For the Java API I would start at a page such as
/secure/admin/ConfigureCustomField!default.jspa?customFieldId=14083
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 ConfigureCustomField.java and the method getConfigs, which has schemeManager.getConfigSchemesForField(customField);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :
You may see the highlighted lines: there are the allowed values for the customfield_11110.
Hope it helps !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.