-
Type:
Suggestion
-
Resolution: Unresolved
-
None
-
Component/s: Documentation - All
-
None
-
1
-
2
On the Advanced cleanup guide, we can share two other Groovy scripts to help admins cleanup unused: Issue Type Schemes and Field Configurations.
Unused Issue Type Schemes
import com.atlassian.jira.component.ComponentAccessor; def schemeManager = ComponentAccessor.issueTypeSchemeManager; def sb = new StringBuffer(); sb.append("Unused Issue Type Schemes to be deleted:\n"); schemeManager.getAllSchemes().each { try{ if(it.getAssociatedProjectIds().size() == 0 && !it.name.startsWith("Default")) { sb.append(it.id + "\t" + it.name + "\n"); // Comment the line below to just list the schemes schemeManager.deleteScheme(it); } } catch(Exception e) { sb.append("X\tError: " + e + "\n"); } } return "<pre>" + sb.toString() + "<pre>";
Unused Field Configurations
import com.atlassian.jira.component.ComponentAccessor; def layoutManager = ComponentAccessor.getFieldLayoutManager(); def sb = new StringBuffer(); sb.append("Unused Field Configuration Schemes to be deleted:\n"); layoutManager.getFieldLayoutSchemes().each { try { if (it.getProjectsUsing().size() == 0) { sb.append(it.id + "\t" + it.name + "\n"); // Comment the line below to just list the schemes layoutManager.removeFieldLayoutScheme(it); } } catch (Exception e) { sb.append("X\tError: " + e + "\n"); } } return "<pre>" + sb.toString() + "<pre>";