How to include sub-tasks in a filter

Morgan Canfield April 21, 2017

I have this filter to give me what was completed this week across a couple projects.  I only get the Tasks, but no Sub-tasks.  Anyone know how to get the done tasks and done sub-tasks?  I would want the done sub-tasks even when the parent tasl may still be open.

project in (project1, project2) AND status = Done AND resolved >= -1w AND assignee in (user1, user2, user3) ORDER BY "Epic Link"

Thanks,

 

Morgan

8 answers

5 votes
Cathleen Griffeth June 20, 2019

you can include subtasks in filters without a plugin... here is an example that works - we used components to segregate boards on PROJECTNAME: 

project = PROJECTNAME AND component = COMPONENTFORFILTER OR issueFunction in subtasksOf("component = COMPONENTFORFILTER ") ORDER BY Rank ASC

Tim June 20, 2019

IssueFunction isn't OTB JQL

Cathleen Griffeth June 20, 2019

the question doesn't mention OTB as a requirement - just that a solution is required.  I believe I answered the question with yet another option.

Tim June 20, 2019

Apologies Cathleen, I mistakenly thought you were reply to another post.

Gavin Coleman April 21, 2020

Thanks Cathleen, this worked a treat for me.

e.g. for others:
AND Component = Finance or issueFunction in subtasksOf("component = Finance")

mochadwi October 31, 2021

Seems can't find subtasksOf function today in (2021), also write a comment about the alternative:

https://community.atlassian.com/t5/Jira-Software-questions/Re-Re-JQL-to-show-all-issues-and-subtasks-in-an-epic/qaq-p/1850003/comment-id/168416#M168416

 

tl;dr

linkedissue = SAPP-10885 OR linkedissue = SAPP-10787
Like stas prodan likes this
2 votes
Guru Darbar October 21, 2022

Hi everyone,

I was able to filter subtasks from an issue using:

`project=MYPROJECTKEY AND parent=KEY`

1 vote
Jobin Kuruvilla [Adaptavist]
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.
April 21, 2017

Are there any subtasks macthing this query? If you expect the subtasks that belong to all the tasks matching this query, that is not how it works.

Subtasks are just another issuetype and they will be returned in the result only if they match the conditions in the query. If you need subtasks from tasks matching to certain criteria, you will need a pliugin like JQL Tricks

Morgan Canfield April 24, 2017

Thanks!  I will look into that.  We're using the Cloud version...

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 24, 2017

This plugin is compatible with Cloud and promises to "find issues by Link, work log, subtasks, comments, etc"

JQL Plus (Mongo Search)

RituM September 14, 2018

I don't think we should have to buy a plugin for such a basic functionality

Like # people like this
Tim January 10, 2019

Yes, it seems you have to buy a plugin to do many basic things in Jira.  I'm glad Atlassian is investing in new technologies, but I wish they would go back and address so many of the simple things that instead get resolved by third parties.

I've wasted countless hours searching for solutions only to find I need to buy a plugin.

Like # people like this
Tim January 10, 2019

For Example, I want to query all sub tasks of a given issue type.  I have to write and maintain a list of parent keys ex. parent in (xxx-1, xxx-2, etc.) or pay for another plugin

Like Stephen Elliott likes this
0 votes
Itai Shturm September 28, 2023

Updating here - there is now a simple way directly without any plugins.
Just add a filter on issuetype = Sub-task

For example:
issuetype in (Epic, Bug, Sub-task)

0 votes
Atilla Bedel April 6, 2023

hi all,

I am using jql query that ı sharing below for showing subtask, may be it can useful for you.


project = PROJECTNAME/CODE AND issuetype in (standardIssueTypes(),subTaskIssueTypes()) ORDER BY Rank ASC(or you can order issues with different parameter)

 

Also you can user this query for multiple project with "in" operation for project parameter.

 

I hope it will work for you.

0 votes
Tomer Madmon December 20, 2021

I have found more practical solution:

  1. Goto parent task in Jira
  2. Click on 3dots above the subtasks list 
  3. Click on view in search 

You will get JQL like:

issueKey in (ABC-111,ABC-222,ABC-333,...)

 

Thanks 

@Tomer Madmon 

0 votes
Daniel Turczanski - __JQL Search Extensions
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 3, 2021

Hi community!

This is an old question but I'm sure this answer is helpful today.

With standard JQL, you can only get a list of issues and export them to Excel for further processing. This works if you want to do a one-off analysis. If your use case is more dynamic than that, look beyond standard Jira.

Standard JQL doesn't easily allow it, but you can quickly find the results using our professional indexing service JQL Search Extensions

After you install the app, you can simply search:

issue in subtasksOfParentsInQuery("project in (project1, project2) AND status = Done AND resolved >= -1w AND assignee in (user1, user2, user3)")

Check out the documentation for more examples.

I hope this helps!
Daniel

Rod May 3, 2022

sub tasks is a major defect in Jira I think.  always makes for confusion and problems.  would be better if stories could hold tasks 

 

epic -> stories -> tasks

 

simples.

Like # people like this
0 votes
SrikanthNarayan May 6, 2021

Hi all, 
I have the same issue in Jira Next Gen, I cant filter based on Subtasks. Any help, please? 

Michael Ballenger May 13, 2021

Same here- seems to be a glitch of some sort.  If I create a simple filter 'project = GSTA ORDER BY Rank ASC', I get subtasks.  As soon as I add to the filter 'project = GSTA AND labels != Post_MVP ORDER BY Rank ASC' my subtasks disappear.

Frank Janisch August 16, 2021

Reason is, that the subtasks have no labels and are therefore excluded from the result when you filter by label...

Suggest an answer

Log in or Sign up to answer