Forums

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

Workflow is not active althought it is associated to project

Omar April 7, 2022

I'm using jira sofware 7.9.2 to create a plugin

I'm adding a customized end point to switch project workflow scheme using:

WorkflowSchemeManager workflowSchemeManager = ComponetAccessor.getWorkflowSchemeManager();
workflowSchemeManager
.removeSchemesFromProject(project);
Scheme scheme = workflowSchemeManager.getSchemeObject(targetScheme.getId());
workflowSchemeManager.addSchemeToProject(project, scheme);

in some cases I found that the scheme is switched but the workflow in side it still inactive although I can see (used by 1 project ) beside the name.

the plugin does not return any errors or exceptions.

any help!, thanks

1 answer

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 7, 2022

Welcome to the Atlassian Community!

You can't just jam a workflow into a workflow scheme, it's a structural item, and you have to check and then migrate everything currently using it as well.

Your code is fine for *inactive* workflow schemes (ones not used by any projects), but it's not doing any of the work you'll need to do for an active workflow or workflow scheme.

This is not a simple task, you have a LOT of coding to do if you want to change an active workflow.  I want to ask why you are trying to do this?  What problem are you trying to solve by switching workflows?

Omar April 7, 2022

thanks for your reply , both workflow and workflow scheme are inactive before being assigned to the project. I'm trying create a workflow scheme that is specific for a project the steps should be:

1- copy the current workflows used by the project

2- create new scheme and give it the same map entries as the current scheme used by the project but with the new copy of the workflow (issue type + workflow)

3-remove the current workflow scheme from the project

4- assign the new created workflow scheme

this is usually works if the project is newly created and it even works fine if I restart the jira instance.

it even sometime switch the workflow to active with now action after  a couple of minutes.

do you see any possible explanation for this ?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 7, 2022

Yes, your code is just setting up a workflow scheme, it's not looking at any of the migrations or changes you need to do when you do that, including all the indexing and caching.

What is your app actually trying to achieve?  What problem is it solving?

Omar April 8, 2022

I'm not migrating the project. I'm simply try to create workflow scheme with it's own workflows then assign it to the project. it already works for project but not for all, if I assign the scheme to the project manually it works fine and need to do it via code.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 8, 2022

That is not what your error messages are telling us.

Could you walk us through exactly what you are doing?

Omar April 10, 2022

thanks for your reply , both workflow and workflow scheme are inactive before being assigned to the project. I'm trying create a workflow scheme that is specific for a project the steps should be:

1- get all entities(workflow + issue type) used by project.

2- create a fresh copy of the current workflows used by the project

3- create new scheme and give it the same map entries as the current scheme used by the project but with the new copy of the workflow (issue type + workflow)

4-remove the current workflow scheme from the project

5- assign the new created workflow scheme

This is usually works if the project is newly created and it even works fine if I restart the jira instance.

it even sometime switch the workflow to active with now action after  a couple of minutes.

Screen Shot 2022-04-10 at 2.54.40 PM.png

 

Here the workflow is inactive although it is used by one project

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2022

Ok, it's step 5 that is the problem.

You can't just flip a workflow over, there's a huge pile of compatibility checks you have to do (and where the workflows are not compatible, you need to give Jira more information). 

You very much are doing a migration here, but your code does not take account of that.  You'll need to write code to handle that migration.

Omar April 11, 2022

Thanks, do you have example to do so, or maybe details on what to be handled during this migration ?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2022

People usually simply use the UI to do the change of workflow.  It's not something you should be changing often for it to be worth automating.

Suggest an answer

Log in or Sign up to answer