Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Display a list of issues link to more than one issue type

Jonathan Mondejar September 17, 2018

We have created some custom issue type (e.g. High-level Requirements, Business Requirement, Stakeholder Requirements, etc.) in our Jira instance. We need to list all issues that are linked to more than one issue where issue type is "High-level Requirement"). How can we create this?

We have ScriptRunner add-on, but I can't seem to work it out.

3 answers

0 votes
Jonathan Mondejar September 20, 2018

Guys do you think there is a way for me to use scriptrunner's "aggregateExpression" function to do this. So the jql is like:

 

project = <myproject> and issueFunction in linkedIssuesOf("issuetype='High-level Requirement" and aggregateExpression<"">>1")

0 votes
Prakhar Srivastav {Appfire}
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.
September 18, 2018

@Jonathan Mondejar

You can create a scripted field with Script Runner which has the count of linked issues and use this field for jql search.

 

Regards

Prakhar

Jonathan Mondejar September 18, 2018

If only I find some sort of documentation for me to create scripted field with scriptRunner that counts linked issues and use that as condition in my jql.

Would you be able to give me an example?

Prakhar Srivastav {Appfire}
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.
September 18, 2018

@Jonathan Mondejar

Here is the documentation for creating scripted field :

https://scriptrunner.adaptavist.com/5.0.4/jira/scripted-fields.html

 

You can use this line of code to get all the links :

List<IssueLink> allOutIssueLink = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId());

I need to ready my instance before I can give you the complete script, meanwhile you can try for yourself. 

Prakhar Srivastav {Appfire}
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.
September 18, 2018

@Jonathan Mondejar

 

Here you go for the script :

Use inward or outward link as per your need.

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


List<IssueLink> allOutIssueLink = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getId());
List<IssueLink> allInIssueLink = ComponentAccessor.getIssueLinkManager().getInwardLinks(issue.getId());

return allOutIssueLink.size() as Double

You can use it in jql like this :

linkedIssueCount > 1

 

Note : Be careful to select number searcher while defining the custom field.

0 votes
Tarun Sapra
Community Champion
September 18, 2018

Hello @Jonathan Mondejar

Using  Script runner it should be pretty straight forward to implement.

From  docs -

issueFunction in hasLinkType("Blockers") and resolution is empty

In the above sample, change "blockers" by the type of the link which other issues are connected to the "High-level Requirement" issueType

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events