It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bulk delete workflows, screens in JIRA cloud.

Ash Apr 23, 2019

Hi Team,

 

Is there a way we can get a list of unused workflows, workflow schemes, Screens, screen schemes and delete them in JIRA cloud? 

 

Thanks

1 answer

0 votes
Petterson Goncalves Atlassian Team Apr 23, 2019

Hello Ash,

I hope you are having a nice day.

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()

You can customize the Script above to delete the schemes you want too.

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

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

How to bulk delete Inactive/Draft workflow

Let me know if this information helps/

Ash Apr 24, 2019

@Petterson Goncalves this is the error i see while i'm running the above code.

 

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script1.groovy: 1: unable to resolve class com.atlassian.jira.component.ComponentAccessor @ line 1, column 1. import com.atlassian.jira.component.ComponentAccessor ^ 1 error at com.adaptavist.sr.cloud.workflow.AbstractScript.parseScript(AbstractScript.groovy:51) at com.adaptavist.sr.cloud.workflow.AbstractScript.evaluate(AbstractScript.groovy:32) at com.adaptavist.sr.cloud.workflow.AbstractScript$evaluate$0.callCurrent(Unknown Source) at com.adaptavist.sr.cloud.workflow.AbstractScript$evaluate$0.callCurrent(Unknown Source) at com.adaptavist.sr.cloud.events.ScriptExecution.run(ScriptExecution.groovy:27) at ConsoleScriptExecution2_groovyProxy.run(Unknown Source)

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

2,684 views 6 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you