JIRA project template - How to link to existing workflow?

I created a project template plugin, according to the tutorial here:

https://developer.atlassian.com/display/JIRADEV/Creating+a+Project+Template

It works fine.

But I try to avoid creating always a new workflow scheme, new issue type scheme and etc.
How to use existing ones? Removing <add-project> in <project-blueprint> is not the solution, because I don't any other element, which I can use to link to existing stuff.

Any hint would be appreciated.

And where to find the API description of: com.atlassian.jira.blueprint.api ??

2 answers

1 accepted

I got the following information from an atlassian member:

unfortunately Project Templates is designed to create new issue type and workflow schemes on each project creation and it is not possible through the JSON file to reuse an existing one. You can however use existing issue types by using the same name in the JSON configuration file. For example, if 'Bug' exists and you specify an issue type with name 'Bug' it will use the existing one in the system.

If there would really be a need to reuse existing schemes, you might try doing this through the AddProjectHook: don't specify a JSON configuration file and just do the creation/reusing of the schemes in that hook programatically.

Nice Idea, a hint to a code snipped would be nice ,-)

Hi Fred, the only chance is to change it programatically, see here: https://answers.atlassian.com/questions/279944/change-issue-type-scheme-programatically I hope Atlassian will update the blueprint interface, because right now it is not usable.

Here is a snippet of code that gives you a start:

@Override
public ConfigureResponse configure(final ConfigureData configureData) {
ConfigureResponse configureResponse = ConfigureResponse.create();

// Obviously you need to change the logic and add some null pointer protection. but it gives you an idea
WorkflowSchemeManager workflowSchemeManager = ComponentAccessor.getWorkflowSchemeManager();
Project project = configureData.project();
AssignableWorkflowScheme workflowScheme = workflowSchemeManager.getWorkflowSchemeObj(10100l);

MigrationHelperFactory migrationHelperFactory = ComponentAccessor.getComponent(DefaultMigrationHelperFactory.class);

try {
AssignableWorkflowSchemeMigrationHelper workflowSchemeMigrationHelper = migrationHelperFactory.createMigrationHelper(project,workflowScheme);
workflowSchemeMigrationHelper.doQuickMigrate();
} catch (GenericEntityException e) {
e.printStackTrace();
}

return configureResponse;
}

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 ...

2,760 views 11 18
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