Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

IssueLinkCreatedEvent not working as expected

Hi Team,

I'm trying to update the security level while linking from "More".

I wanted the security level of the destination issue to be set as the source issue after linking.

I get run time error, after linking. 

Please find below my code and the error and kindly do the needful,


import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.fields.IssueLinksSystemField
import com.atlassian.jira.event.issue.IssueEvent

def IssueEvent event = event

def issue = event.issue as MutableIssue


def issueManager = ComponentAccessor.issueManager
def issueType = "Acquired Product Defect"
def linkedIssueType = "SRT Event"

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

def SourceSecurityLevel = ComponentAccessor.getIssueSecurityLevelManager().getSecurityLevel(issue.getId())

def eventTypeManager = ComponentAccessor.getEventTypeManager();
def eventType = eventTypeManager.getEventType( event.getEventTypeId() );
def eventTypeName = eventType.getName();

if (issue.getIssueType().name == issueType) {
if( eventTypeName == "Issue Link Created" ){
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
issueLinkManager.getOutwardLinks( {issueLink ->
Issue linkedIssue = issueLink.getDestinationObject() as MutableIssue
if (linkedIssue.getIssueType().name == linkedIssueType) {







2019-01-07 07:51:18,973 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2019-01-07 07:51:18,974 ERROR [runner.AbstractScriptListener]: Script function failed on event:, file: <inline script>
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '' with class '' to class 'com.atlassian.jira.event.issue.IssueEvent'

Rajakumar Sivakumar


2 answers

Hi @Rajakumar Sivakumar this is untested but should work


* Update the security level while linking from action
* This should get the issueSecurityLevel from the issue and set it in the linked Issue
* When the issueType is "Acquired Product Defect" and the linked issueType is "SRT Event"

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.index.IssueIndexingService
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.user.ApplicationUser

MutableIssue issue = event.issue as MutableIssue
String issueType = "Acquired Product Defect"

if (issue.getIssueType().name.equals(issueType)) {

IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager()
IssueManager issueManager = ComponentAccessor.getIssueManager()
ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
String linkedIssueType = "SRT Event"
MutableIssue linkedIssue

issueLinkManager.getOutwardLinks( {
IssueLink issueLink ->
linkedIssue = issueLink.getDestinationObject() as MutableIssue

if (linkedIssue.getIssueType().name.equals(linkedIssueType)) {

issueManager.updateIssue(currentUser, linkedIssue,EventDispatchOption.DO_NOT_DISPATCH,false)


Forgot to mention that this only work as spected when you specify the event type in the select list as "IssueLinkCreated" and if the IssueSecurityScheme is used in both issueTypes (same project or same IssueSecurityScheme in different projects).

Hi Rajakumar, 

While I'm not sure that it covers every aspect you're wanting, this community question contains a response that shows how to set a security level using a listener. I think this is what you're wanting to do and that this post will help point you in the right direction. 

Please let me know if this helps you out or if I can help you sort anything else out. If you continue having trouble can you please send me a screenshot of the listener you currently have setup so that I can get replicate what you're doing. 

Hope this helps! :)

Jenna Davis

Suggest an answer

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

Happy New Year and Welcome New Marketplace Partner Program Partners!

Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...

454 views 6 18
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