How to bulk delete screen schemes or issue type schemes?

Hello,

For huge instance it very tough to manage or delete unused schemes in bulk

I see https://jira.atlassian.com/browse/JRASERVER-60618 as verified in Atlassian Backlog

Is any one ever deleted schemes in bulk, I think it can be done in Script Runner Console

Can anyone plz help me with the script

Regards

Dave.

2 answers

1 accepted

 

This will remove all Issue Type Screen Schemes without any associated projects:

import com.atlassian.jira.component.ComponentAccessor

def schemeManager = ComponentAccessor.issueTypeScreenSchemeManager

def sb = new StringBuffer()

sb.append("Deleted issue type screen schemes with no associated projects:<br/><br/>\n")
schemeManager.issueTypeScreenSchemes.each {
try{
if(it.projects.size() == 0) {
sb.append("${it.name}<br/>\n")
schemeManager.removeIssueTypeScreenScheme(it);
}
}
catch(Exception e) {
//noop
sb.append("Error: " + e + "<br/>\n");
}
}

return sb.toString()

Hi Bill. How to delete un used screens ? I mean screens not associated to any screen scheme or workflow ?

Here's the script to delete Screen Schemes not used by any Issue Type Screen Schemes

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.screen.FieldScreenSchemeManager

def fssm = ComponentAccessor.getComponent(FieldScreenSchemeManager.class)
def itssm = ComponentAccessor.issueTypeScreenSchemeManager

def sb = new StringBuffer()

sb.append("Deleted screen schemes with no associated issue type screen schemes:<br/><br/>\n")
fssm.fieldScreenSchemes.each {
try{
if(itssm.getIssueTypeScreenSchemes(it).size() == 0) {
fssm.removeFieldScreenScheme(it);
sb.append("${it.name}<br/>\n");
}
}
catch(Exception e) {
//noop
//sb.append("Error: " + e + "<br/>\n");
}
}

return sb.toString()

Thanks, alot Bill 

Really appreciate your super quick response 

Hey Bill 

For bulk delete Issue type scheme we can't use id or project size right as default issue type scheme is not associated to any project!

Thanks

Dave.

As far as I'm aware, the Default Issue Type Screen Scheme is not really a default, it's just named as such.  You can rename it to whatever you want.  It doesn't get used  unless a project is specifically associated with it.  In our instance we have some projects associated with it, so my testing did not uncover what happens if it has no projects associated to it and you try to delete it.

Yeah Issue type screen scheme is not default but we have default issue type scheme for issue types right for Global (all unconfigured projects)

Deafult Issue type scheme.png

 

 

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Fadoua M. Boualem
Published 4 hours ago in Trello

Using Trello to manage events

As a Jira power user, I was at first doubtful that Trello could benefit my workflow. Jira already uses boards (ones you can customize!), so why would I even need to use Trello?! In this post you will...

235 views 3 4
Read article

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