Query to find all issues related to an EPIC (including subtasks)

Kia Kund August 20, 2018

This seems to be one of the most ridiculous problems I have ever encountered. How can it even be hard (let alone impossible) to find all issues related to a specific EPIC without making the ugliest query ever?!

In order to find the epic issue (including its subtasks) along with its epic linked issues and their respective subtasks, I seem to have two alternatives:

Alternative 1

issue = PROJ-1234 OR parent = PROJ-1234 OR "Epic Link" = PROJ-1234 OR issueFunction in subtasksOf("\"Epic Link\"=PROJ-1234")

Alternative 2 (which sucks since this query will also return issues that are linked using other link types)

issue = PROJ-1234 OR issueFunction in linkedIssuesOfAllRecursiveLimited("issue = PROJ-1234", 2)

 

I have gone through every forum thread imaginable and I don't understand why for example "parentEpic" or tempoEpicIssues() doesn't work. I think the former is not available for JIRA server and the latter you need developer permissions for.

 

5 answers

7 votes
Ignacio Pulgar
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 20, 2018

You're right: The parentEpic() function is just on Cloud.

Your Alternative 1 query is almost correct, and it can be slightly improved like this:

key = PROJ-1234 OR "Epic Link" = PROJ-1234 OR issueFunction in subtasksOf("\"Epic Link\"=PROJ-1234")

Alternatively, you may save a filter named 'Epic' with this jql:

"Epic Link" = PROJ-1234

...so that you can use it in a nicer query like:

key = PROJ-1234 OR filter = Epic OR issueFunction in subtasksOf("filter = Epic")

 

Kia Kund August 20, 2018

Hi Ignacio,

How is "key" different from "issue"? It returns the same result, right?

Kindly,

Tobias

Like Ignacio Pulgar likes this
Ethan Kim January 25, 2019

Thanks!

Fabian Hußl February 7, 2020

Thanks!

0 votes
Eduardo Godinez March 12, 2024
JQL QueryPurpose
"Parent Link" = JIRA-123 AND issuetype = Task AND resolution = unresolved

It displays any open task within an epic

parent in (JIRA-123) AND resolution = unresolved

It displays any open subtask within an epic

"Parent Link" = JIRA-123 AND issuetype = story AND resolution = unresolved

It displays any open story within an epic

This is what I use :) 

0 votes
Deepa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 25, 2023

This is what worked for me example:
(project = DF149 AND "Epic Link" = DF149-2496 AND (issuetype = Story OR issuetype = Task )) Or (project = DF149 AND issueFunction in subtasksOf("\"Epic Link\"=DF149-2496")) Order by "Start date" 

0 votes
Jason Vogel November 19, 2019

Using JIRA v7.7.0 - no addins...

Type this into Advanced Search

issue = BIT-1230 OR parent = BIT-1230 OR "Epic Link" = BIT-1230 OR issueFunction in subtasksOf("\"Epic Link\"=BIT-1230")

Received this response...

Field 'issueFunction' does not exist or you do not have permission to view it.

What am I missing?

Ignacio Pulgar
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 21, 2019

You need to count with ScriptRunner addon installed in your Jira instance for being able to use issueFunction.

Like Alex Hunt likes this
Jason Vogel November 21, 2019

Is there a way to do this without having a plugin installed?

Ignacio Pulgar
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 23, 2019

Hi Jason. I'm afraid there's no JQL way in Jira Server to get the subtasks of issues that belong to the specified epic without the help of a plugin.

Of course, there would be ways for getting them through SQL, by querying directly against the database, but that's usually considered a bad practice...

Hemendra Shah December 22, 2021

To get issues linked to EPIC use below query

issue in linkedIssues(PRJ-1124)

Dave Pointon June 13, 2022

@Hemendra Shah

That query doesn't return any "issues" below depth = 1 - I have heard of 'linkedIssuesRecursive()' (which sounds like it might generate an appropriate list), but I've no clue as to how/where to access it.

0 votes
Ignacio Pulgar
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 21, 2018

Yup, it's the same than issue but shorter, which is specially good for long queries... hehe.

Suggest an answer

Log in or Sign up to answer