How can we find the unused workflow, workflow schemes and screens, Screen schemes etc and delete it?

Please let me know if we have any way to find the workflows/screens etc that are not used in any projects so that those can be deleted. I know the manual way to achieve this. However, since we have many schemes which cannot be done manually, can you please let me know if this can be achieved via some script(Groovy/script lisetner, etc)

Script to find the Unused Workflows, Workflow schemes, Screens, Screen schemes, issue type screen schemes

Script to delete the Unused Workflows, Workflow schemes, Screens, Screen schemes, issue type screen schemes.

Current Jira version is 7.2.9

Your help is highly appreciated!

Thanks in advance.

Deepa

2 answers

0 votes

>since we have many schemes which cannot be done manually

All schemes can be done "manually".  I don't understand what you mean here.

Thanks for your relpy Nic..
Manually deleting 500+ workflows and screens that are unused is a very tedius process. I wanted to know the other options to achieve this.

Can you please help with this.

 

-Deepa

For inactive workflow you can use  below script

Line commented will delete the inactive workflow, please uncomment if you want to delete

Workflow deletion

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

461 views 7 5
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you