Display LinkedIssue field in JIRA issue navigator JQL

  • Post author:
  • Post category:Blog
  • Post comments:0 Comments
  • Reading time:2 mins read

Cause

  • In JIRA we can show the links for the issue by Linked Issues in Columns option. That will display all issue keys that are linked to the issue. But this option displays the keys only
  • You want to display some useful info like Summary, Status of the linked issue rather than the Key

Solution

For example: I want to display the parent summary of all issues that have LinkedIssues type defined in JIRA as “Parent -> Child” name

Name Outward description Inward description
Parent -> Child is a parent of is a child of

For the issue TOSQUAD-8 has Issue Links as “is a child of” TOSQUAD-3

We can resolve the problem by using the Adaptavist ScriptRunner Custom field as below

  • Go to JIRA Administration | Manage apps | ScriptRunner | Fields
  • In the Script Fields screen click on the Create Script Field button then Custom Script Field selection on the next screen
  • In the Custom Script Field providing enough info and add the following script
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.link.IssueLink;
import com.atlassian.jira.issue.link.IssueLinkManager;

Issue issueObj  = issue

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def inwardLinks = issueLinkManager.getInwardLinks(issueObj.id)
def outwardLinks = issueLinkManager.getOutwardLinks(issueObj.id)

for(IssueLink issueLink: inwardLinks){
    def linkTypeName = issueLink.getIssueLinkType().name
    if(linkTypeName == "Parent -> Child")
    {
       	def sourceName = issueLink.getSourceObject().getSummary() 
    	return sourceName 
    }
}
return null
  • Test the script with value TOSQUAD-8 we received result = Feature 3 is the Summary of TOSQUAD-8 as picture

Leave a Reply