Cannot Resolve IssueLink - Scriptrunner Listener

Shawn Danisa May 17, 2019

I am experiencing the above the script below.  I am trying to pass the fix version to the story from the epic to ensure that the story has the same fix version as the epic.

The second error I get is: Unable to Resolve Class Mutable and Unable to resolve Class IssueLink

Jira Version 8.0.1

Scriptrunner: 5.5.6.1-jira8

Below is the script:

import com.atlassian.jira.issue.link;
import com.atlassian.jira.component.ComponentAccessor;


def issue = event.issue

if(issue.issueType.name == "Epic")
{
def projectKey = issue.projectObject.key

def change = event?.getChangeLog()?.getRelated("ChildChangeItem.find").find{it.field == "Fix Version"}
def issueLinkManager = ComponentAccessor.issueLinkManager;
def issueManager = ComponentAccessor.issueManager;

if(change)
{
issueLinkManager.getOutwardLinks(issue.getId()).each {IssueLink issueLink ->
if(issueLink.getIssueLinkType().getName() == "Epic-Story Link")
{
def destinationIssue = (MutableIssue)issueLink.getDestinationObject();
if(destinationIssue.projectObject.key.equals(projectKey))
{
destinationIssue.setFixVersions()
issueManager.updateIssue(event.getUser(), destinationIssue, EventDispatchOption.ISSUE_UPDATED, false)
}


}


}
}

}

 

Please assist 

1 answer

1 accepted

0 votes
Answer accepted
Ivan Tovbin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2019

Hi, @Shawn Danisa 

Make sure your imports look like this:

import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.component.ComponentAccessor;

Suggest an answer

Log in or Sign up to answer