Forums

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

Is there a way to bulk delete the inactive workflows?

Robert Colburn November 1, 2018

We have several JIRA projects buitl out and as changes were made backup were also made, now there is a large number of inactive workflows that need to be removed. I am hoping someone knows a way to bulk delete those inactive workflows, rather than removing them one by one...

1 answer

1 accepted

2 votes
Answer accepted
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 1, 2018

Hello Robert,

You can use the add-on Script Runner and run the following Script to delete all inactive workflows (Except the default):

import com.atlassian.jira.component.ComponentAccessor

def workflowManager = ComponentAccessor.workflowManager
def schemeManager = ComponentAccessor.workflowSchemeManager

def sb = new StringBuffer()

workflowManager.workflows.each {
if(!it.systemWorkflow) {
def schemes = schemeManager.getSchemesForWorkflow(it)
if (schemes.size() == 0) {
sb.append("Deleting workflow: ${it.name}\n")
workflowManager.deleteWorkflow(it)
}
}
}
return sb.toString()

P.S: System default workflow should be assigned to some scheme, otherwise script won't work.

For more information about it, please check the question below:

How to bulk delete Inactive/Draft workflows

Randy Knight August 9, 2020

Getting the following when trying to run the above from Script Console.  

 

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 1: unable to resolve class com.atlassian.jira.compnent.ComponentAccessor @ line 1, column 1. import com.atlassian.jira.compnent.ComponentAccessor

Rabbit
Contributor
October 20, 2020

Yeah, this is not working in Cloud with scriptrunner, alas.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events