Last active
          March 7, 2021 09:19 
        
      - 
      
- 
        Save epishan/a3d59ebc292961daf95e1e77e5573470 to your computer and use it in GitHub Desktop. 
    [JIRA] Remove inactive (unassigned) Workflow Schemes
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import com.atlassian.jira.component.ComponentAccessor | |
| def schemeManager = ComponentAccessor.workflowSchemeManager | |
| def sb = new StringBuffer() | |
| def schemes = schemeManager.getAssignableSchemes() | |
| if(schemes != null) { | |
| schemes.each { | |
| if (schemeManager.isActive(it)) { | |
| sb.append("|||||| Skipping active wf scheme: ${it.name} \n") | |
| } else { | |
| try { | |
| schemeManager.deleteWorkflowScheme(it); | |
| sb.append("|||||| REMOVED wf scheme: ${it.name} \n") | |
| } catch (RuntimeException e) { // EDIT --- Should be Exception, RuntimeException | |
| sb.append("|||||| FAILED to remove wf scheme: ${it.name} \n") | |
| } | |
| } | |
| } | |
| } | |
| return sb.toString() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment