Open Parent Issues with All Subtasks Closed

Ryan Murphy June 17, 2014

I'm looking for the best JQL query to provide a list of all open standard issues where every subtask has been closed. I've been using Script Runner to come up with some pretty great queries but I can't seem to get it to work in this instance.

The closest that I can get is the following query but it doesn't seem to check whether every subtask is in the closed stauts, apparently just one of the subtasks:

project = PROJECT AND issuetype in standardIssueTypes() AND status != Closed and issueFunction in parentsOf("project = PROJECT and status = Closed")

Can anyone help me refine this query or use another one that accomplishes what I need?

4 answers

1 accepted

4 votes
Answer accepted
JK
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.
June 19, 2014

Hi Ryan,

I don t have enough subtasks in our tickets to test it properly, but I edited Vijays statement a little bit: as you get issues where subtasks are both open and closed, I made one subquery to a "not in status != closed". Hopefully that works...

project = PROJECT and issuefunction in parentsOf("issuefunction in subtasksOf(\"issuefunction not in parentsOf('type in subTaskIssueTypes() and status != closed') and status != closed and type in standardIssueTypes()\") and status = closed")

Ryan Murphy June 19, 2014

This one seems to work. I was able to return all open tickets where all the subtasks are closed. It also seems to ignore any open tickets with no subtasks. Great job to both Jochen and Vijay! Thank you so much.

Ankit Mathur November 28, 2018

Hey Jochen/Vijay,

This query really helped me a lot!

Is it possible (I am guessing no) to have a query that will return all parent tasks with their subtasks closed, however disregard the status for a subtask with the summary "Project Management".

So if Task A has 3 subtasks, out of which 2 are closed

1)Project Management (open)
2)Subtask 2 (closed)
3)Subtask 3 (closed)

It will return Task A as one of the results.

Nithya Ananda September 18, 2020

Bingo! Thanks alot!

0 votes
Patricia Bermejo September 15, 2022

I would like to obtain a similar query but to obtain the subtaks in open status but the issue parent with closed status. is this possible?

Thanks.

0 votes
Ryan Murphy June 18, 2014

Hi Vijay,

Thansk for your prompt response. I tried the query but it seems to not respond with open parent tickets with all subtasks closed. I see open tickets with only a few, but not all, subtasks closed. Any other ideas?

0 votes
Vijay Khacharia
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.
June 18, 2014

This was challenging :)

Here is the JQL.

issuefunction in parentsOf("issueFunction in subtasksOf(\"issuefunction in parentsOf('project= PROJECT and type in subTaskIssueTypes() and status = closed') and status != closed and type in standardIssueTypes()\") and status != closed")

Hope this works for you.

Vijay.

Vijay Khacharia
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.
June 19, 2014

Hi Ryan,

I gave a thought again and found an easier solution. Find all the tasks that are open, exclude all the tasks that has open subtasks.

Here is the JQL

project = PROJECT and type in standardIssueTypes() and status != closed and not (issueFunction in parentsOf("project = PROJECT and type in subtaskIssueTypes() and status != closed"))

Vijay Khacharia
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.
June 19, 2014

The problem here is it returns a task even if doesnt have any sub tasks.

Suggest an answer

Log in or Sign up to answer