issue.get("security") now returns a Long instead of a GenericValue

Problem

After upgrading JIRA Misc Workflow Extensions to version 3.6.1 or JIRA Misc Custom Fields to version 1.6, scripts (in calculated custom fields or post-function execution conditions) that are using the following code will stop working:

issue.get("security").get("name")

This is due to a change in the JIRA API for accessing the Issue's Security Level. It now returns a Long (the Security Level ID) instead of a GenericValue.

Solution

You should modify the scripts that access the issue's security level through a call to issue.get("security"). You can either rely on the Security Level ID (a 5-digit numeric value), or use the IssueSecurityLevelManager to access the name of the Security Level:

if (issue.get("security") == 10000)
  [...]

or

com.atlassian.jira.issue.security.IssueSecurityLevelManager islm = com.atlassian.jira.ComponentManager.getComponent(com.atlassian.jira.issue.security.IssueSecurityLevelManager.class);
 
if ("A Security Level Name".equals(islm.getIssueSecurityName(issue.get("security"))))
	[...]

There is no content with the specified labels