Set project Field Configuration Scheme programmatically

Hi, We are trying to set some project schemes programmatically for an inside development. We are able to set some schemes like: notification scheme, issue security scheme, permission scheme, issue type screen scheme, etc. using WorkflowSchemeManager, PermissionSchemeManager, etc etc etc. But we don't know how to set the Field Configuration Scheme and the Issue Type scheme Any ideas on how can we set those 2 schemes to projects??? Regards

4 answers

try with this

FieldConfigurationScheme srcProjectFieldLayout = fieldLayoutManager.getFieldConfigurationScheme(srcProjectGV)
        if (srcProjectFieldLayout) {
            fieldLayoutManager.addSchemeAssociation(newprojectGV, srcProjectFieldLayout.getId())

for your reference

@Iryna, if some thing helped you don't forget to voteup/accept as a answer,

it will help other users to choose right answer

this doesn't copy IssueTypeScheme, but I found a solution in your reference.

Thanks =)

Hi all,

for the issue type scheme (based on AssociateIssueTypeSchemes):

FieldConfigScheme newIssueTypeScheme = fieldConfigSchemeManager.getFieldConfigScheme(issueTypeSchemeId);

        JiraContextTreeManager treeManager = ComponentManager

        // Set the contexts
        List<JiraContextNode> contexts = CustomFieldUtils.buildJiraIssueContexts(false,
                new Long[]{project.getId()},

        ConfigurableField configurableField = newIssueTypeScheme.getField();
        fieldConfigSchemeManager.updateFieldConfigScheme(newIssueTypeScheme, contexts, configurableField);


and for the field layout configuration scheme:

FieldLayoutScheme fieldLayoutScheme = fieldLayoutManager.getMutableFieldLayoutScheme(fieldLayoutSchemeId);
      fieldLayoutManager.addSchemeAssociation(project, fieldLayoutScheme.getId());

Thanks, you saved me.

But can you tell how you retrieve issueTypeSchemeId in your example ?

i ahve given link check there you will get entire code

0 vote
Colin Goudie Community Champion Jul 21, 2013

IssueTypeScheme has a manager


issueTypeSchemeManager.create("name of scheme", "description", issueTypdIds);

The issueTypeIds is a List of Strings whose id's are the IssueTypes to go in that scheme

Colin Goudie Community Champion Jul 21, 2013

I'll checkout FieldConfigurationScheme as was looking at that recently myself

Hi. Have you found any solution for setting Issue Type Scheme?

I actually tried to set it with IssueTypeSchemeManager but couldn't do it till now.

But Field Configuration you can set with this (here i was copying scheme from one project to another, but i think this will be the same with created scheme):

com.atlassian.jira.issue.fields.layout.field.FieldLayoutManager flmanager = ComponentManager.getInstance().getFieldLayoutManager();

org.ofbiz.core.entity.GenericValue projectFrom = pmanager.getProjectByKey(keyFrom);

org.ofbiz.core.entity.GenericValue projectTo = pmanager.getProjectByKey(keyTo);

com.atlassian.jira.issue.fields.layout.field.FieldConfigurationScheme fieldConfigurationScheme = flmanager	.getFieldConfigurationScheme(projectFrom);

Long fieldLayoutSchemeId = fieldConfigurationScheme.getId();

flmanager.addSchemeAssociation(projectTo, fieldLayoutSchemeId);

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,198 views 13 19
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot