Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to bulk edit issue security levels' name

Gaston December 13, 2023

Hi

 

Some of my security levels have whitespaces at the end, and I need to trim them.

Reading the documentation I came across  updateIssueSecurityLevel, but it only takes a security level, there is no way of updating the name.

 

I've also tried creating a new security level with the same ID and a new name using

createIssueSecurityLevel, but there is no way of using the same ID.
this is my code 

 

import com.atlassian.jira.component.ComponentAccessor


// Get the Security Level Manager
def issueSecurityLevelManager = ComponentAccessor.issueSecurityLevelManager
 
def securityLevels = issueSecurityLevelManager.getAllIssueSecurityLevels()

// Print the names of security levels
securityLevels.each { securityLevel ->

 
        def updatedSecurityLevel = issueSecurityLevelManager.createIssueSecurityLevel(securityLevel.id, securityLevel.name.trim(), securityLevel.description)
         
        issueSecurityLevelManager.updateIssueSecurityLevel(updatedSecurityLevel) 
 


}


0 answers

Suggest an answer

Log in or Sign up to answer