How to get subtasks of an EPIC in a filter query?

Paulo Costa
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!
July 20, 2020

Hi all,

I'm sort of new with JIRA and I am trying to get a board that shows me all work related to an Epic. We are using Epics, Stories and Subtasks of the stories.

My query looks something like 

  • project = CXT AND "Epic Link" = CXT-2120

This way I am not able to display the subtasks on my filter/board.

The alternative would be to use tasks and then manually link them to the Story and to the Epic, which is additional admin work.

Is there something I am missing or is there anyway I can get the subtasks to show in the filter/board?

 

Thanks in advance.

 

5 answers

2 accepted

26 votes
Answer accepted
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 20, 2020

HI @Paulo Costa 

Welcome to the community.

This works in JIRA Cloud. Try it on your system.

project = CXT AND (issuetype = Story AND "Epic Link" IN (CXT-2120)) OR (issuetype = sub-task AND "parentEpic" IN (CXT-2120))

If it works, credit goes to Mark Klein  for the answer in this post.

https://community.atlassian.com/t5/Jira-Software-questions/JQL-to-show-all-issues-AND-subtasks-in-the-Epic/qaq-p/346433 

Italo Qualisoni [e-Core]
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.
July 20, 2020

@Trudy Claspill , 

Cool information, I didn't know until now that parentEpic existed!

parentEpic - Search for issues and sub-tasks that are linked to an epic.

https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-functions/#Advancedsearching-functionsreference-parentepicparentEpic()

Paulo Costa
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!
July 21, 2020

Thanks @Trudy Claspill , I have tried and still does not work. I've read the post you shared and also @Italo Qualisoni [e-Core] shared link, and as we are using JIRA Server, looks like we have to buy some add-ins.

If by any chance you have any other ideas I would appreciate.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 21, 2020

Adaptavist Scriptrunner is a powerful app that extends JQL search functionality, plus provides many other features. I used it at my previous employer and really liked it.

If that offers more than you want and you are looking for something less expensive, check the Similar Apps links at the bottom of its marketplace page to see if any of those can help with extensions for searching.

Like Chris Buzon likes this
Chris Buzon December 21, 2021

This just saved me a HUGE amount of time.  Thanks, Trudy!

Aaron Valleroy
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!
February 15, 2022

Says parentEpic doesnt exsist?

Like # people like this
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 15, 2022

@Aaron Valleroy 

Welcome to the community.

Are you using a Jira Cloud instance?

Can you provide a screen image of what you see?

JM Flores August 23, 2022

thanks! worked perfectly.

Jade Blackwater (Kalles Group, LLC)
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!
August 13, 2023

So much gratitude for this immediate solution!! THANK YOU, Trudy Claspill and Mark Klein.

Mindaugas Girdvainis
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!
August 14, 2023

Worked like a charm. Thanks! :)

2 votes
Answer accepted
Jack Nolddor [Sweet Bananas]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 22, 2020

Hi,

Sadly you cannot achieve the desired search using standard features on Jira, you must go for a third-party app instead. Using i.e. JQL Booster Pack (if you are on Server / DataCenter) you can type the following:

 

0) The Epic itself

key = CXT-2120

1) Subtask created directly on Epic

issue IN subtasksOf(' key = CXT-2120 ')

2) Find all tasks (Tasks, Stories,...) under a given Epic (i.e. CXT-2120)

"Epic Link" = CXT-2120

3) Find all subtasks under returned issues above

issue IN subtasksOf(' "Epic Link" = CXT-2120 ')

4) All together (Epic, Tasks & Subtask)

key = CXT-2120 OR "Epic Link" = CXT-2120 OR issue IN subtasksOf(' key = CXT-2120 OR "Epic Link" = CXT-2120 ')

(*) Note that this is just an example, you must tune above query to fit your needs.

 

Using this app you can also query other issues relations, check:

 

Regards

6 votes
Paul Matteucci July 8, 2021

@Paulo Costa 

I realise it's a year later, but there's a command called "epicParent" that does just this:

parentEpic = EPIC-1

or

parentEpic in (EPIC-1, EPIC-2)

I hope this helps.

Cheers 

Hector Meurice September 2, 2021

Thank you Paul, it actually worked!

Alex R_ April 26, 2023

Unfortunately, epicParent does not appear to be a native field.

2 votes
Joviano DIas December 4, 2023

This is what worked for me without needing any add-ons.

All items including subtasks contained in the EPIC

issue in childIssuesOf("epic-2191")

Only subtasks of the epic

 issue in childIssuesOf("epic-2191") and issuetype in subTaskIssueTypes()  

 Not subtasks

 issue in childIssuesOf("epic-2191") and issuetype not in subTaskIssueTypes() 

 

Jawad Newaj
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!
April 6, 2024

Thank you so much for this simple and effective solution! This has worked for my problem!

1 vote
Alexander Agneessens December 14, 2021

Alternative solution:

I was facing the same issue I was looking for an answer too!
But I found a solution without the need of any additional Jira add-ons.

So if you want to have all stories & the sub-tasks of these stories in one JQL filter, you have to refer in your JQL filter to a structure.

So first create your structure e.g. "STRUCTURE_X"
In your structure you use as JQL query to insert all stories linked to that epic:
issue in linkedIssues("epic-1234") or ("Epic Link" = epic-1234)

Now you have a structure with all the stories linked to the epic.
What is still missing are the "subtasks"
So in your structure, you add -> Extend > Subtasks...

Now you have a structure with all stories and all subtasks connected to these stories.
So the structure results in Epic > Story > Subtasks

 

Now you go back to your quick filter:
and add the following JQL query: issue in structure("STRUCTURE_X")


=> That's how I was able to solve it on my end.. Hope it helps..

Florencia Pocetti
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!
July 29, 2022

Hi @Alexander Agneessens i'm trying to follow your guideline, is it possible to copy paste the SQL filter you used?
I'm not quite sure I've sure I've followed the Structure Step 

Alexander Agneessens July 29, 2022

Hi @Flore the JQL is quiet specific to your project 
but you could just enter the following as JQL:
 issue in linkedIssues("epic-1234") or ("Epic Link" = epic-1234)

Press "Automation" > Insert > JQL querry
And than you just enter as JQL: 

issue in linkedIssues("epic-1234") or ("Epic Link" = epic-1234)
-> With the issue keys for you project.

But maybe share what you would like to obtain as a result, that will allow me to give better feedback..
Or do you get an error when you follow my steps ? Or where do you get stuck?

Mike Hoffman May 25, 2023

I'm with Florencia here - I'm trying to follow, but you haven't indicated how to define a structure. Can you give an example of what the full JQL would look like, including setting up and then implementing the structure?

Suggest an answer

Log in or Sign up to answer