"Link Dependencies" order in Issue Navigator

Raynard Rhodes
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.
August 15, 2019

I've created a scripted field in ScriptRunner that will display linked issues with link "depends on".

This works fine, but when I go to the issue navigator and order by this custom field...there are blank spaces between showing "depends on" issues. I assume it's because it's holding the collection and not displaying due to it not being "depends on".

Is there a way to display all of the "depends on" issues directly below one another?

 

Link_Dependecies.PNG

 

Here is the code

import com.atlassian.jira.ComponentManager
import groovy.xml.MarkupBuilder
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.link.LinkCollectionImpl;
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.component.ComponentAccessor;


String results = "";
def valid = false;
def baseurl = com.atlassian.jira.component.ComponentAccessor.getApplicationProperties().getString("jira.baseurl")
def browse = "/browse/"


List<IssueLink> allOutIssueLink = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId());
for (outIterator in allOutIssueLink) {
IssueLink issueLink = (IssueLink) outIterator;
def linkedIssue = issueLink.getDestinationObject()
String type = issueLink.getIssueLinkType().name;
if(type.contains("Depends on"))
{
valid = true;
results += "<a href=\"${baseurl}${browse}${linkedIssue.getKey()}\">${linkedIssue.getKey()}</a>" + "<br />"

}
}

if(valid){return results;}

0 answers

Suggest an answer

Log in or Sign up to answer