It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner and Issue Security Levels Edited

I want to automate/set the Issue Security Level from with a groovy script (in a listener script, based on some other info in the issue).

Next code seems to work:

issueManager.updateIssue(securityUser, mutableIssue, EventDispatchOption.DO_NOT_DISPATCH, false)

where issueSecurityLevelId is the id of a Issue Security Level that is in a scheme associated with the project the issue is in. And securityUser is a user that has the rights in the project to set the Issue Security Level.

For my test I hard coded the Issue Security Level id.

But my question: how to find the issue Security Levels that can be used with the current project ? Or how to get the Issue Security Scheme associated with the project, and how to get the Issue Security Levels in the Scheme ?

1 answer

1 accepted

1 vote
Answer accepted

Hi Marc, 

Hopefully the following will help 

import com.atlassian.jira.component.ComponentAccessor

def issueSecuritySchemeManager = ComponentAccessor.getComponent(IssueSecuritySchemeManager)
def issueSecurityLevelManager = ComponentAccessor.getComponent(IssueSecurityLevelManager)

def schemeFromName = issueSecuritySchemeManager.getSchemeObjects().find { == "Name of the Scheme" }
def schemeFromProject = issueSecuritySchemeManager.getSchemeFor(ComponentAccessor.projectManager.getProjectByCurrentKey("ATG"))

def securityLvl = issueSecurityLevelManager.getIssueSecurityLevels( { it -> == "Security Level A"

 Let me know if you have any more questions,

Regards, Thanos

Hi Thanos,

Thanks for your answer.I was missing the method issueSecuritySchemeManager.getSchemeFor(Project) !

This indeed solves my problem!


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Do you miss a recurrence feature in Jira to handle your managed service contracts?

  If your company uses Jira and Tempo and deals with managed services, you probably feel the need to create or simulate contract recurrence to better track your services in a monthly basis, for...

68 views 0 0
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you