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.

3 answers

1 accepted

5 votes
Accepted answer

 

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 ?

Hi Bill, Hope you can help?
Under screens, I have lot of old copies, is there a way to also bulk delete these?

Thanks for your answer, i did searched some more yesterday and found this information.
should have wrinten a comment here.

Thanks again 

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

 

 

Hi @Teja Namala

 

I managed to delete the workflows and schemes one-by-one, but gave up when it came to deleting screens.

I just shared this article on bulk deleting them with JMeter:

https://community.atlassian.com/t5/Jira-articles/Bulk-deleting-unused-screens-in-Jira-with-JMeter/ba-p/961695

 

It doesn't require additional apps/plugins and is quite safe, since it's just automatically firing HTTP requests that could be made by an actual (admin) user.

 

Cheers

Hi @Bill Neff - I ran the bulk delete issue type screen schemes on  a test instance. this appeared to work fine / same as if I manually deleted. 

However, then when I ran the bulk delete screen schemes script, even though the issue type screen schemes some of these screen schemes were originally connected to were now gone and no relationship was displayed in the ui, the "delete" link did not appear in the UI. I then modified the delete script just to audit the relationship between the issue type screen schemes and screen schemes and based on this, it appears that an issue type screen scheme is still connected to these screen schemes even though none is visible in UI.

Any thoughts/suggestions? Anyone else have this issue?

Thank you!
Donna J.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

131 views 0 6
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