Find parent issues that are not closed while all their sub-tasks are in Closed status

Myroslav Kravchenko June 23, 2017

Hi all,

It happens that QA team forgets to move parent story from RTT into Closed status, despite all sub-tasks are already Closed. I want to be able to filter such issues.

Query:

status = RTT and issueFunction in parentsOf("project = XXX and status = Closed")

returns parent issues that have at least one sub-task in Closed status, but I need it to return parent issues that have ALL sub-tasks in Closed status.

Any ideas how to achive that?

 

3 answers

1 accepted

2 votes
Answer accepted
Myroslav Kravchenko July 1, 2017

Continued to fight with Jira and have found one query solution:

project = XXX and status !=Closed and 
(issueFunction in parentsOf("status in ('Closed')")
and not issueFunction in parentsOf("status in
(Open, 'In progress', 'Code review', 'Ready to test')"))

 

Tarald Røste April 26, 2019

Nice, concise and perfect :)

Brian Longstreet January 12, 2020

issueFunction isn't available in my instance of Jira. Are you using another app plug-in?

Like Anthony Boisbouvier likes this
Damir Kadyrov February 11, 2020

I think the OP is using ScriptRunner for his instance

Suresh.Kumar June 4, 2021

i am getting error as mentioned below and not getting the results. Please suggest

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

Chad Schaeffer June 6, 2022

Small tweak to make it more generalized using statuscategory rather than a list of statuses.

 

statuscategory != Done AND issueFunction in parentsOf("statuscategory = Done") AND NOT issuefunction in parentsof("statuscategory != Done")

0 votes
Myroslav Kravchenko June 23, 2017

Actually, I've found a slight workaround using 2 queries from Jira and further comparison in GSheets or Excel:

This query will return all stories that have at least one incomplete subtask:

status = RTT and issueFunction in parentsOf("project = XXX and status in (Open, 'In progress', 'Code review', RTT)")

This query will return all stories that have at least one closed subtask:

status = RTT and issueFunction in parentsOf("project = XXX and status = Closed")

Then in Spreadsheets we'll filter all issues from last query that aren't present in first - that will be our target list.

Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 23, 2017

Great that you found out a workaround. But I could see " Not In " works with Status. on JIRA 7.1.6 Capture.JPG

Myroslav Kravchenko June 23, 2017

It works. But your suggested solution doesn't refine the list. See screenshot as a proof (same issues are listed for 2 different queries): 

Issue+Navigator+-+Ciklum+Interactive+JIRA+-+Google+Chrome+2017-06-23+12.18.29.png+%E2%80%8E-+Photos+2017-06-23+12.20.16.png

Suresh.Kumar June 7, 2021
issueFunction is not working for me. please suggest
0 votes
Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 23, 2017

Can you try a workaround like this ? 

status = RTT and ( issueFunction in parentsOf("project = XXX and status = Closed") AND (issueFunction in parentsOf("project = XXX and status not in ( Open, In Progres)" ) ? 

 Please note, I couldn't test this since I don't have access to any instance at the moment. 

Myroslav Kravchenko June 23, 2017

Hi Vishnukumar,

Thank you for your idea. But, much to my regret Jira doesn't support "not in" operator for status field in parentsOf function.

Here is a Jira error message in full:

  • Error in scripted function: parentsOf, see below
  • Operator 'not in' does not support the non-list value '"Open"' for field 'status'.
Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 23, 2017

NOT IN operator supports Status field. Could you cross check if you have 'Open' state for the above project or issue type ? 

Myroslav Kravchenko June 23, 2017

Yes, here is a proof:Issue+Navigator+-+Ciklum+Interactive+JIRA+-+Google+Chrome+2017-06-23+11.46.35.png

 

Thomas Schlegel
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 23, 2017

Hi Myroslav,

change it to (... and status not in (Closed)")

Myroslav Kravchenko June 23, 2017

Thank you, Thomas. Syntax was corrected, but still both queries return the same output:

Issue+Navigator+-+Ciklum+Interactive+JIRA+-+Google+Chrome+2017-06-23+12.18.29.png+%E2%80%8E-+Photos+2017-06-23+12.20.16.png

Suggest an answer

Log in or Sign up to answer