Cannot extract IssueLink from issue


I have 2 Jira instances (01 & 02) which are linked. Each instance contains an issue (TEST01-1 & TEST02-1). The issues are linked to each other (reciprocal link). My goal is to extract TEST01-1 from the link in TEST02-1, therefore I have written the following code:


import com.atlassian.jira.issue.Issue

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import org.apache.log4j.Category

def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def allRelatedIssues = new LinkedList<Issue>()
for (IssueLink link in issueLinkManager.getOutwardLinks((Long)10400)) {

log.debug ('Size of Issue-List: ' + allRelatedIssues.size())
log.debug ('Content of Isse-List: ' + allRelatedIssues)
log.debug ('Size of IssueLink-List Outward: ' + issueLinkManager.getOutwardLinks((Long)10400).size())
log.debug ('Size of IssueLink-List Inward: ' + issueLinkManager.getInwardLinks((Long)10400).size())
log.debug ('Issue-Key for the Issue-ID 10400: ' + ComponentAccessor.issueManager.getIssueObject(10400 as long))

When I execute the code in the Script console I obtain the following output:

2017-11-10 15:51:29,780 DEBUG [groovy.PostFunction]: Size of Issue-List: 0
2017-11-10 15:51:29,780 DEBUG [groovy.PostFunction]: Content of Isse-List: []
2017-11-10 15:51:29,780 DEBUG [groovy.PostFunction]: Size of IssueLink-List Outward: 0
2017-11-10 15:51:29,780 DEBUG [groovy.PostFunction]: Size of IssueLink-List Inward: 0
2017-11-10 15:51:29,781 DEBUG [groovy.PostFunction]: Issue-Key for the Issue-ID 10400: TEST01-1


As the output indicates, the List "allRelatedIssues" is empty and I don't understand why. After all, the Issues are linked, I used the right Issue-ID (see Screenshots) and I performed a re-index just in case. What could be the problem? Does anybody have an idea?


Thank you in advance!



1 answer

1 accepted

This widget could not be displayed.

It seems you have "remote links" in your issues instead of normal issueLinks. Thus "issueLinkManager" won't work as it's for internal links within the same JIRA instance but you have 2 different JIRA instances.

Try this code snippet

RemoteIssueLinkService remoteIssueLinkService = ComponentAccessor.getComponent(RemoteIssueLinkService.class)
RemoteIssueLinkService.RemoteIssueLinkListResult links = remoteIssueLinkService.getRemoteIssueLinksForIssue(currentUser, issue

 (you have to use "RemoteIssueLinkService") 

Hi Tarun,

thank you very much for your quick respond. You are right - that was the problem - now it's solved! :)

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

158 views 2 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you