Forums

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

set security level to linked issue which the parent issue holds when linking from "More"

Rajakumar Sivakumar January 3, 2019

Hi Team,

 

I'm new to Script runner..

Please consider two issues, Issue-1 and Issue-2, which has security levels, "SecurityLevelA" and "SecurityLevelB" respectively.

From Issue-1 when I select More->Link and mention Issue-2 and then link it.

I wanted the security level of Issue-2 to be changed from "SecurityLevelB" to "SecurityLevelA"

 I would like to use "IssueLinkCreatedEvent" in listener.

Kindly let me know how this can be achieved.

please find below my code, i suppose it's not right. Kindly help me in getting the code right,

 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.security.IssueSecurityLevelManager
import com.atlassian.jira.issue.security.IssueSecuritySchemeManager
import com.atlassian.jira.issue.link.IssueLinkManager

def issueSecuritySchemeManager = ComponentAccessor.getComponent(IssueSecuritySchemeManager)
def issueSecurityLevelManager = ComponentAccessor.issueSecurityLevelManager
IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager()

def issue = event.issue as Issue

List<IssueLink> l_linkedissue = issueLinkManager.getOutwardLinks(issue)

def l_securitylevel = issueSecurityLevelManager.getSecurityLevel(issue.getGenericValue())

l_linkedissue.setSecurityLevel (secLevelGv)
l_linkedissue.store()

 

 

 

Regards

Rajakumar Sivakumar

rajakumar.s@hcl.com

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events