What's the proper way to rename a security level in scriptrunner?

The IssueSecurityLevelManager interface has a method named updateIssueSecurityLevel whose description is “Updates the name and/or description of security level.” The description matches what I am trying to accomplish.

However, I see a problem. The only parameter is an instance of issueSecurityLevel. Looking at its interface, I see only get methods. There is no setName nor setDescription defined. So I can’t see a way to change a name or description of an existing issueSecurityLevel.

Where possible, try not to use *Manager classes in Jira. OR at least check out how Atlassian uses them in the source code. The manager classes typically do not throw events, properly clear caches, etc. Just a word to the wise.

In this case, you can use IssueSecurityLevelService which gives you a update method for changing the name and description, and it will properly deal with any other things that need handling.

https://docs.atlassian.com/software/jira/docs/api/9.6.0/com/atlassian/jira/issue/security/IssueSecurityLevelService.html