Forums

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

JQL query to filter issues in Project A which are linked and "Relates To" issues in Project B

Vineet_Kotian November 22, 2023

I am creating a custom filter in Project A to filter issues in the Backlog and the Board. I want to be able to filter issues in Project A which are linked to Project B issues (Project B contains potential issues on released versions). This helps to trace the development items in Project A linked to customer issues in Project B.

I tried below queries but it didnt execute:
JQL 1 - project = "Project A" AND issue IN linkedIssuesOf('project = "Project B"')
JQL 2 - project = "Project A" AND issueLink in linkedIssues("Project B")

2 answers

2 accepted

1 vote
Answer accepted
Hannes Obweger - JXL for Jira
Atlassian Partner
November 22, 2023

Hi @Vineet_Kotian

to the best of my knowledge, this is trickier than one would think; your query would really require some kind of join or subquery, which isn't available in plain Jira/JQL.

A few ways forward:

  • If it's a one-off thing, you could first query your relevant issues from project B, and then use the issue keys of these issues in a query like project = "A" AND issueLink in (issue-key-1, issue-key-2, ...)

If you want to run your search dynamically, without manually "stitching" two queries together, you'll need extra tooling:

  • You may be able to use Jira Automation to store the fact that there is a relevant issue link into a custom field, and then use the custom field to query your issues. Obviously, this will add a bit of complexity to your system.
  • There's different apps from the Atlassian Marketplace that can help with that. First, there's a number of apps that extend JQL by additional functions, including issue-link-related functions. linkedIssuesOf, as you're using above, comes from ScriptRunner - I believe the syntax would be issueFunction in linkedIssuesOf(...), though.
  • Alternatively, you could try one of the more hierarchy-focused apps from the Marketplace. These apps typically have their own ways of figuring out relationships between issues, and provide more powerful ways of searching through issue structures. I myself work on such an app, in which your use case would be easy to solve - I'll provide more details below.

Hope this helps,

Best,

Hannes

Hannes Obweger - JXL for Jira
Atlassian Partner
November 22, 2023

Just to expand on the last point, this is how this would look in the app that my team and I are working on, JXL for Jira. Put simply, you'd create a sheet with all issues that are potentially relevant to you, model an issue structure based on "relates to" issue links (that's just a couple of clicks), and then use JXL filtering capabilities to narrow down to the issues that you care about:

issue-linking-to-project.gif

Once you have your list of issues, you can work on these directly in JXL (much like you'd do in e.g. Excel or Google Sheets), trigger various operations in Jira, or export them for further processing.

Any questions just let me know!

0 votes
Answer accepted
Charlotte Santos -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.
November 22, 2023

Hi @Vineet_Kotian

I’m Charlotte, a support engineer at Appfire and I’m here to help you.

Unfortunately, using vanilla JQL, you’ll not be able to do it dynamically.

In the app where my team works, JQL Search Extensions for Jira, you can use this query to find issues from project A that are linked to issues in project B:

 issue in linkedIssuesOfQuery("project='Project B'") AND project="Project A" 

Please contact our support if you have any other questions about this query.

We’ll be happy to help you!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events