Hello,
Just go to cog item -> Issues -> Custom fields. Find the required custom field and go to the configuration screen. Then you can add a new context.
You can find more info here:
https://confluence.atlassian.com/adminjiraserver071/configuring-a-custom-field-802592532.html
go to the adding new context part.
Thanks Alexey, But I was looking for doing it programatically.
I am doing the following thing
/*********************************************************************/
/* CUSTOM CONTEXT*/
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
FieldConfigSchemeManager fieldConfigSchemeManager = ComponentAccessor.getFieldConfigSchemeManager();
FieldManager fieldManager = ComponentAccessor.getFieldManager();
ArrayList<CustomField> customFields = new ArrayList<>();
customFields.add(customFieldManager.getCustomFieldObject(10504L));
ProjectContext newProjectContext = new ProjectContext(project.getId());
for (CustomField customField : customFields) {
/** It will fetch all the configuration scheme available on custom field **/
List<FieldConfigScheme> fieldConfigSchemes = customField.getConfigurationSchemes();
String configName = project.getKey() + ": Configuration scheme for " + project.getName();
String description = ": Configuration scheme for " + project.getName();
FieldConfigScheme firstScheme = fieldConfigSchemes.get(0);
FieldConfigScheme configScheme = new FieldConfigScheme.Builder()
.setName(configName)
.setDescription(description).toFieldConfigScheme();
List<JiraContextNode> existingSchemes = firstScheme.getContexts();
JiraContextNode newContextNode = newProjectContext;
List<JiraContextNode> updatedSchemes = new ArrayList<>();
for (JiraContextNode scheme : existingSchemes) {
updatedSchemes.add(scheme);
}
updatedSchemes.add(newContextNode);
List<IssueType> list = new ArrayList<>(firstScheme.getAssociatedIssueTypes());
fieldConfigSchemeManager.createFieldConfigScheme(configScheme, updatedSchemes,list ,customField);
}
fieldManager.refresh();
/****************************************************************/
I am able to create new config scheme. But now I am trying to copy the options from default config scheme to new config scheme
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandan,
We also have a dedicated Developer Community that might be good to check out for development related questions. Since the topics are more focused, it's easier for other developers to watch the questions coming in and provide guidance.
This might be useful, not just for this question, but for all your recent Community posts.
If you've figured out the answer, please let us know if you can to help others who might run into similar problems!
Cheers,
Keri
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.