Searching for subtasks of parents that meet certain criteria

Allan Chow March 21, 2012

I have quite a bit of subtask cleanup that I need to do. I'd like to find all subtasks of Parent Issues that are in the closed state. I was hoping to do something along the lines of:

parent in (status = closed)

or even

parent in (filter = closedIssuesFilter)

Is something like this possible? What would be the best way to accomplish this?

14 answers

1 accepted

24 votes
Answer accepted
Piotr Polak April 26, 2013

You can also use Script Runner plugin and a query like:

issueFunction in subtasksOf("project = XXX AND issuetype = Task AND status = Closed")

Enelar March 11, 2016

It is paid version. What the point.
We unable to create board with sub-issues (filtered by version, epic, component). When you click at issue, and looking into subtask, what you see? Hided by filter.

Atlassian knows and forcing us to pay more. I do not know why it still isn't in the box.
They sells product with several flaws, half-stuffed. I think they starving of good competition. 

Like # people like this
Rade Martinović March 11, 2016

Hey Kirill,

 

I have ScriptRunner version 3.1.4 installed, which is free. You can install it manually. I don't have the need for subtasks anymore, but if you find ScriptRunner useful I think that you should at least try it out.

Ben Richman June 28, 2016

Can anyone help? I am using the latest version of Script runner and when running the above JQL to search for sub tasks i get this error:

 

  • Error in scripted function: subtasksOf, see below
  • com.atlassian.jira.jql.parser.antlr.RuntimeRecognitionException
SHISHIR AGARWAL November 3, 2016

try using below :

 

issueFunction in subtasksOf("key = ABC-XX")

 

Where ABC-XX is your JIRA number

Like Kevin Kelly likes this
Shyam Suchak February 7, 2018

Doesn't work for me.

Matt Doar
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 2, 2018

Did work for me either

Natasha Denny February 24, 2019

Is there any way of using the query in scriptrunner but to return all issues rather than just subtasks?

Like Jenn Rakestraw likes this
andrew nalesnik May 18, 2020

Hello this is a very old thread but I have found a solution to the problem. (As I was searching for a way to do this)

What this solves: Filtering subtasks of a selected parent without the need for a plugin.

project = "YOUR PROJECT" AND issuetype=Sub-Task AND issueFunction in subtasksOf("key=JIRA TICKET ID")

Like Tâm_Lê likes this
Juan Jativa June 4, 2020

I almost got excited.

But you are using the plugin ScriptRunner for the issueFunction

Like # people like this
Simeon Herbert April 1, 2021

Need to do exactly what Andrew says but we are not allowed to use Scriptrunner - any ideas?

urmid April 21, 2021

You do not require any Plugin, atleast not for JIRA cloud. Go to the filter screen and switch to Advanced, you can type in below query and get all the relevant Sub-Tasks. Do note the double quotes inside the 'subTasksOf' function is mandatory.

 

project = 'You Prj' and issueFunction in subtasksOf("status = Done")

chandu_subash May 5, 2021

issueFunction in subtasksOf("status = Done")

gettting below error while trying the above

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

Like # people like this
Meetu June 30, 2021

same for me

Allan Machado Poppe July 1, 2021

Same

27 votes
Hassan Saleem November 13, 2013

There is no need for any Plugin..

Switch to "advance" filter option and enter

status in ("Open") AND parent in (PHX-xxx,ENG-xxx)

It will give you all the open tickets present as a subtask in parent JIRAS. Build more complex and enjoy using JIRA. Advance filter options will also give you all possible values to build Queries.

Please comment if its helpful.

Regards.

Hassan Saleem

Quality Control Engineer

Wellogic. U.A.E

Jennifer Kenemer January 14, 2014

Hassan, I'm trying your solution but I'm getting error "The issue key 'CP' for field 'parent' is invalid." CP is our project key. What am I doing wrong?

Like soloyes likes this
Rade Martinović June 29, 2014

Not really good suggestion as a filter like this would work only at one point in time. I need "search for parents with condition" for my Agile board.

Linda Schmandt February 19, 2015

Jennifer, are you using the full issue number in 'parent'? It has to be CP-1234 (or whatever)

Jennifer Kenemer February 19, 2015

Yep using the full issue name including number. I still have not found a way to do this without a plugin (we still don't have one that would help with this).

Linda Schmandt February 19, 2015

Odd. We don't have any plugins, either, and I was able to do it just this morning. What version of JIRA are you using? What's the exact query?

Jennifer Kenemer February 19, 2015

Wait, I was mixing up my questions, sorry!! For this one, I wanted to be able to search for all closed issues that have open subtasks in a specific project.

Rade Martinović February 19, 2015

Exactly, I needed to search for subtasks when I don't know how many parents I have, but I know their condition. I cannot use full issue key here "CP-12345". I resorted to Script Runner in the end.

Richard Cullen March 31, 2015

Any solution for OnDemand where we can't install arbitrary plugins?

Kyle Mitofsky April 21, 2016

It would absolutely fantastic if this was supported in the basic query editor.  Basic queries are substantially easier to compose than advanced queries, and there's already a metaphor for searching based on an issue in the epic link field.

RituM September 14, 2018

Hassan, the solution you're offering will not work if I only want to include subtasks of a issues from a query.

Like Daniel Hammer likes this
Gabriel Neacsu May 14, 2019

Works like a charm. Thanks!

Joshua Urban September 11, 2019

Works. Thank you

urmid April 21, 2021

This can be done with advanced query, something like below. This will give all 'Open' Subtasks for Parents whose status is 'Done'.
project = 'Your Project' AND status =Open AND issueFunction in subtasksOf("status = Done") ORDER BY status ASC

Allan Machado Poppe July 1, 2021

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

Meetu July 7, 2021

same for me

19 votes
Charles Porter November 18, 2016

Would really like to be able to query for all issues and their sub-tasks in (for instance) an Epic.

All the answers here require either multiple manual step, hard coded Issue ID's or a plugin. Can't use the suggested plugin in Cloud Jira.

It is surprising and disappointing that something this basic is hard or impossible in the JIRA query language

4 votes
M. P. September 4, 2013

I don't know whether it's still relevant, but we had same problem and it was solved with help of following plugins:

- Query Issue Custom Field delivers validators, that can be checked also for status etc.

- AM Utils delivers opportunities search for parents/subtask and create JQL inside another one, like

  • issue in issueParents("project = AAA")
  • issue in issueSubtasks("project = AAA")

Maybe it can help

Enelar March 11, 2016

AM Utils great, but outdated

Susan Escalona-Sauro March 3, 2020

That didn't work for me but this did. Pulled up all the tasks, stories and subtasks in an EPIC. I've been looking for this answer for months!!!

parentEpic = dev-1422

Like # people like this
Joris Vleminckx March 19, 2020

parentEpic does the trick!

Paige January 27, 2021

I am using v8.5.9 and get the following when I try to use parentEpic..

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

No idea if this is a versioning issue, or if my company admins have locked that field down...  I am admin of my project in Jira, but we have company level Jira administrators too

2 votes
Francisco Correa January 7, 2020

If you happened to filter for Issues under an Epic, and you have subtasks/defects under your Issues, you can use parentEpic

In my case, issue AB-1234 is the Id of the Epic under which all issues and their subs are hierarchically organized

 

project = AB AND "Epic Link" = AB-1234 OR parentEpic = AB-1234 ORDER BY Rank ASC

Then all issues of the EPIC and all their subtasks show and can be displayed using Swim-lines

Note that the subs do not have to have the EPIC identified as they take it from the parentEpic

Lee-Ann COSTA February 13, 2020

Thank you !!!! I've been looking for help with this for a while and this query finally worked for me!

Like Francisco Correa likes this
Daniel Brvnišťan February 26, 2020

Hi Francisco,

Is there any way to modify the query so it would return all issues under all Epics that are in certain project (not the project of issues, but of Epics).

Something like:
"Epic Link" contains "AB-"

We have Epics that are cross-projects (if that's a good practice is a valid question, but not now please :) ).

Thanks!
Daniel

2 votes
Suzanne Seaton November 14, 2016

I had the following request:Is there a way to search for subtasks of change requests?

Here is the JQL for that:

issueFunction in subtasksOf(" issuetype = 'Change Request' ")  AND category =

"Client Service Desk Projects"

1 vote
Andreas Lärkfeldt January 21, 2021

LOL - WHY do everybody keep using "hardcoded" issue keys (like KEY-1234). You should never use "hardcoded" keys! Period! :D

So did someone actually find a solution for Jira Cloud in this matter?
(where we DONT need to update issue keys manually)

Sorry - but this isn't the only thread I've seen "people trying to help, but who doesnt".

 

Kind regards

Andreas

Paige January 27, 2021

parentEpic has worked for some, but it doesn't work for me...

I am using v8.5.9 and get the following when I try to use parentEpic..

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

No idea if this is a versioning issue, or if my company admins have locked that field down...  I am admin of my project in Jira, but we have company level Jira administrators too

1 vote
Per Gradeen March 21, 2013

Issue nav.

- > Configure Columns

-> add subtasks

Copy all. subtasks

Paste in advanced search

key in (Sub-1, Sub2...)


Search...

But maybe u can start by selecting done issues and see subtask...

0 votes
Josh Elias May 12, 2021

Why hasn't Atlassian implemented this feature yet?

0 votes
Justė Žiliūtė October 2, 2019

.

0 votes
Preethi Ramesh April 1, 2019

I was trying to exclude all subtasks from a specific parent key and used the below query. Worked for me. 

assignee in (<jira usernames>) AND status not in (Closed, Done, Complete, Resolved, Cancelled) AND project not in (<give project names that you would like to exclude>) AND  parent != <which ever parent key you would like to exclude> 

 

This query removed all the subtasks for the parent key

0 votes
Nikita Breikin March 5, 2019

linkedIssue in linkedIssues("ISS-111")

0 votes
gcarignano January 22, 2019
Dennis Gerads February 11, 2019

That's only available if you are using Jira Server.  What can be used with the Web version?

Dan4 November 15, 2019

No longer free

Like Viet Cao Hoai likes this
Viet Cao Hoai January 4, 2021

Yes. No longer free

Suggest an answer

Log in or Sign up to answer