Very easy, try to enter in the “Groovy Script Console” and execute this code.
import com.atlassian.jira.component.ComponentAccessor def workflowManager = ComponentAccessor.workflowManager def schemeManager = ComponentAccessor.workflowSchemeManager def sb = new StringBuffer() workflowManager.workflows.each { def schemes = schemeManager.getSchemesForWorkflow(it) if(schemes.size() == 0) { sb.append("Deleting workflow: ${it.name}\n") workflowManager.deleteWorkflow(it) } } return sb.toString()
source extracted from here
There’s an error
The workflow is assigned to workflow schemes
com.atlassian.jira.workflow.WorkflowException: The workflow is assigned to workflow schemes
at com.atlassian.jira.workflow.OSWorkflowManager.deleteWorkflow(OSWorkflowManager.java:456)
at com.atlassian.jira.workflow.WorkflowManager$deleteWorkflow.call(Unknown Source)
at Script79$_run_closure1.doCall(Script79.groovy:12)
at Script79.run(Script79.groovy:8)
LikeLiked by 1 person
In my side is working fine. The code if(schemes.size() == 0) { is to avoid workflows assigned to schemes.
Thanks for comment
LikeLike
We can use try and catch to avoid the error for the workflows already assigned to a Workflow Scheme but inactives.
LikeLike