Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Update a custom field's context.

DonPerera
Contributor
September 19, 2019

I have tried the following code to update the custom fields context.

CustomField field = customFieldManager.getCustomFieldObjectsByName(customField).iterator().next();
FieldConfigScheme defaultConfig = field.getConfigurationSchemes().iterator().next();
List<JiraContextNode> contexts = defaultConfig.getContexts();
List<JiraContextNode> newContexts = new ArrayList<>(contexts);
newContexts.add(projectContext);
FieldConfigSchemeManager fieldConfigSchemeManager = ComponentAccessor.getFieldConfigSchemeManager();
fieldConfigSchemeManager.updateFieldConfigScheme(defaultConfig, newContexts, field);
ComponentAccessor.getFieldManager().refresh();

But the new context does not get applied .

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events