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: ${}\n")

return sb.toString()

source extracted from here

Posted by:.

3 replies on “How to delete all Inactive/Drafts Workflows in JIRA in one shot with Groovy Scriptrunner

  1. 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(
    at com.atlassian.jira.workflow.WorkflowManager$ Source)
    at Script79$_run_closure1.doCall(Script79.groovy:12)

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s