error when running groovy script

Gunti_Reddy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 17, 2020

Hi, 

 Getting below error at line .  Please help

List listLinkEpics = issueLinkManager.getOutwardLinks(epicIssue.getId());

Message:
groovy.lang.MissingPropertyException: No such property: issueLinkManager for class: script1592379359056136729314

package com.starhome.jira;
import com.atlassian.jira.issue.*;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.issue.link.IssueLinkManager;
import com.atlassian.jira.issue.issuetype.IssueType;
import java.util.*;

def String[] LEGAL_SUB_EPIC_LINKS = ["Story", "Defect", "Bug", "Query/Clarification"]
List legalIssues = Arrays.asList(LEGAL_SUB_EPIC_LINKS);
IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager();

 

String GetRMIDKeyfromEpic(Issue epicIssue)
{

List listLinkEpics = issueLinkManager.getOutwardLinks(epicIssue.getId());

 

//List listLinkEpics = EpicIssue.get("issuelinks");
Issue issueRMID = null;
for( int i = 0; i < listLinkEpics.size() ; i++ )
{
IssueLink LinkEpic = listLinkEpics.get(i);
if (LinkEpic.getIssueLinkType().getName().equalsIgnoreCase("Include"))
{

issueRMID = LinkEpic.getDestinationObject();

}
}
if (issueRMID == null)
{
return "Roadmap Item at Epic level is empty";
}
else
{

return issueRMID.getKey();
}
};

 

String isIssuetype = issue.get("issuetype").getName();
if (isIssuetype.equalsIgnoreCase("Epic"))
{


return GetRMIDKeyfromEpic(issue.getIssueObject());

 

1 answer

1 accepted

0 votes
Answer accepted
Mathis Hellensberg
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.
June 17, 2020

Just move "IssueLinkManager issueLinkManager = ComponentAccessor.getIssueLinkManager();" inside the scope of your function :)

Gunti_Reddy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 17, 2020

Thanks mathis :)

Mathis Hellensberg
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.
June 17, 2020

@Gunti_Reddy You are welcome! Can i get you to accept my answer? :)

Mathis Hellensberg
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.
June 17, 2020

@Gunti_Reddy Thank you!

Suggest an answer

Log in or Sign up to answer