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
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?
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 ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is not what your error messages are telling us.
Could you walk us through exactly what you are doing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
Here the workflow is inactive although it is used by one project
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.