How to search all linked issues with issues from specific project and with specific link type

Petr Vaníček
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.
March 7, 2019

Hi,

I got interesting question from my collegue, but I'm not sure how to procede his request.

By my short testing with JQL I found this:

issue in linkedIssues(DEFDEV-644) 

But I need something like this (not working JQL - just idea behind it. So I want all issues from all project where are issues linked with any issue in project DEFDEV by link issue type "Realized by".

issue in linkedIssueProject(DEFDEV) and linkType = "Realized by" 

 Do you have any idea ho to do this (with or without add-on - doesn't matter).

Thanks

Petr

6 answers

1 accepted

8 votes
Answer accepted
Jean-Théo [Adaptavist]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2019

Hello Petr,

You can do this if you have Scriptrunner installed:

https://community.atlassian.com/t5/Jira-questions/How-to-find-all-issues-that-have-a-link-type-CLONE/qaq-p/32959

issuefunction in hasLinkType("Cloners") and issue in linkedIssues(DEFDEV-644)

 You just need to change the link name!

Hope this helps,

JT

Petr Vaníček
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.
March 7, 2019

I think it's not what he need. 

He need issues from whole Jira which are linked with any issue from specific project by specific link type.

I just tried look into Scriprunner documentation, but I'm not sure which JQL function use for this use case.

Jean-Théo [Adaptavist]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2019

I think I misunderstood your initial question, it is clearer now!

The function you need is probably linkedIssuesOf.

You can achieve what you need with something like :

issuefunction in linkedIssuesOf('project = projectName', 'is cloned by')

 But this function uses a one direction link, if you need both directions, you can use something like :

issuefunction in linkedIssuesOf('project = projectName', 'is cloned by') or issuefunction in linkedIssuesOf('project = projectName', 'clones')

I hope this answers a little more your question! 

Like # people like this
Petr Vaníček
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.
March 7, 2019

It looks like it's exactly what we want, thanks.

Like Jessica Borges Alves likes this
6 votes
Sutapa Basu April 19, 2022

I actually find a easier way to find the linked items just by adding the links column on my search result. 

Thanks for all you suggestions. 

2 votes
Enrico Stabile December 9, 2022

issue in linkedIssues("<ID of the ticket>","<link type>")

 

for example:

issue in linkedIssues("PROJ-123","parent of")

Shows all the tickets which are child of PROJ-123

Gautam De February 6, 2023

When I tried this, I am getting error 'Issue link type 'parent of' could not be found in function 'linkedissues'

 

But the below one worked

issue in linkedissues("proj-123")

Like Andrei Ionut Sandu likes this
Enrico Stabile February 7, 2023

With the "linkedissues("proj-123") you get the ticket as soon as it is somehow linked to the proj-123.

if you want to specify which relation, you gotta type it (check that the relation is spelled like that in your project, or it exists)

Brock Jolet February 12, 2024

Is there a way to use the "issue in linkedIssues()" function by specifying the link type id instead of a string that might change?

1 vote
Melissa C January 7, 2022

Hello Everyone!!!

I wanted to build on this query but I'm not sure if it is possible in Jira Server 7.13.

issue in linkedIssues (XYZ-2222) AND project = "Product Management"

This gives me any linked issues in XYZ-2222 but only those Issues in the Product Management Project.  Thanks for posting this answer!


I wanted to take it a step further,  For the results of this query I want to see any Tasks/SubTasks, I tried using the parent() function but I wasn't able to nest it properly.  

Is this possible out of the box? 

Does anyone have any suggestions on how to do this?

1 vote
Sofian November 25, 2021

Great !, I found this answer just at the right time. It works perfectly.

Thank you !

0 votes
Sutapa Basu April 18, 2022

Hi,

I am trying to build search filter with JQL query where I need to see the list of all link items for specific sprint. Any idea how i can accomplish this task?

 

Thanks

Melissa April 19, 2022

@Sutapa Basu 

sprint = XXXXX

You will need to find the Sprint ID and this will give you all Jiras in that Sprint.

You can also see if it will autofill so if you type sprint then choose = and begin to fill in your sprint name it might autofill.  

Hope that helps

Sutapa Basu April 19, 2022

Thanks, I understand the sprint= SprintID will give me all the items in the current sprint, but I like to if there is any prior linked item for any of the item listed for the sprint.

 

Thanks

Melissa April 19, 2022

@Sutapa Basu 

Try 

issuefunction in hasLinkType("Link") AND Sprint = XXXXX

 

I would do "Sprint is not EMPTY" so it shows everything and then I would narrow it down

Let me if that works

Karen Lewis July 27, 2022

I know that this is now 2022 and the question was asked in 2019, but JIRA now offers JQL to search by a specific link type. For example, I needed to find all the tickets that are owned by CRM-209 and this is the JQL that does that: 

project = "CRM" AND issueBelongsTo = "CRM-209"

Like # people like this

Suggest an answer

Log in or Sign up to answer