Is there JQL that will group subtasks under tasks?

Mike C November 23, 2016

I have a business group (most of them new to JIRA) that is tracking their work with tasks and subtasks.  They want to run a query that will show each task with its related subtasks grouped underneath.  They want to be able to export the results to Excel (which I expect can be done via csv).  We're using a local (server) installation of JIRA Software 7.1, and this group is currently using a "Business" project, though we're willing to change the project type (and issue types, for that matter) if that would let us do this.

I've been digging through the documentation, Answers and also Stack Overflow, but can't find any way to do this (at least not without adding plug-ins).  I've been thinking that maybe the best way to go is a calculated custom field that would return the same value for each parent + all its children, then create a filter and order the results by (first) that custom field and then (second) by issue type within that.  But maybe there's some easier way I'm overlooking?

Any guidance appreciated... thanks!

5 answers

8 votes
Steve Lewis October 23, 2017

We are using JIRA version 7.3.6 . This JQL statement gave me a list of all unresolved issues with the sub-tasks listed under their parents. The parents are listed in order of key - I think.

project = CC AND resolution = Unresolved ORDER BY rank ASC

I am then exporting it to Printable but I expect it works for export to csv.

Graham Eckel February 6, 2018

I have no idea what object "rank" is, but this worked for me. Thanks!

Like # people like this
Marcus Hansson December 12, 2018

For information, the ORDER BY rank ASC only works for projects with a board and must have enabled ranking so sub tasks are ordered under their parent: https://confluence.atlassian.com/jirasoftwarecloud/enabling-ranking-764477994.html

Like # people like this
Ronald de Roij October 29, 2019

The command "rank" worked for me. Thanks!

Like Steve Lewis likes this
Don Prather January 3, 2020

Talk about some JQL voodoo.. I have no idea what "rank" is as I've never used it as far as I can remember.. but for some reason, it sorts my subtasks under their parent tasks just the way I expect.  Thanks, Jira master of magic!

Like Steve Lewis likes this
Sandra Rita H June 23, 2020

it would be great to colour code or format the parent task  in some way. I have used this query in a confluence table and visually its hard to separate subtasks from the parent. I have the issue type indicator, but they are both blue anyway

Matthew Davison August 7, 2020

Genius. Didn't even think about the rank field! (subtasks inherit rank from parent)

Thanks!

R N January 19, 2021

You made my day! Thanks, works just fine!

3 votes
Khanh Q_ Do January 10, 2021

This query made my day project = "PIANOPLUS" AND Sprint=51 AND type IN (subTaskIssueTypes(), standardIssueTypes())  ORDER BY rank ASC

Claudio Rouillon January 20, 2021

This one works a treat, thanks Do Quoc!

Héctor Castillo January 21, 2021

thanks Do Quoc! exactly what we need!

2 votes
Boran Gögetap October 18, 2017

One way to group task and sub-tasks visually in JIRA with no extra plugin is a Board (Kanban will do), with a single column.

The board query must include all desired tasks (i.e. top-level tasks and sub-taks). Then JIRA will present sub-tasks neatly nested inside their respective top-level tasks.

0 votes
Robert Leitch [ALM Works]
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.
November 23, 2016

Hi Mike,

Unfortunately I don't think this is possible to achieve without add-ons or modifying JIRA beyond what's allowed by the standard admin tools (a calculated field might indeed work, but requires an add-on for the calculated field...).

If using a plugin is an option though, this can easily be done with our Structure add-on.

You would make a structure that looks something like this:

image2016-11-24 10:11:7.png

 

And the Excel export would look like this:

image2016-11-24 10:12:16.png

Any fields (columns) you added to the structure will also be exported to Excel - progress, estimates, etc.

 

Sorry for plugging our plugin when you were asking for no plugins sad but Structure really would solve this task in a few clicks. I realise this task alone might not justify the introduction of add-ons to your system, but Structure (and eazyBI, if it can solve this) can do a whole lot more than just grouping issues, and may well bring savings in time and effort in other areas.

 

Cheers,

Robert

0 votes
Deleted user November 23, 2016

Mike, It is fairly easy if you can filter tasks and sub tasks in your project and select the column parent id and sort by the parent id. E.g., Project='x' AND Issuetype in (Task, Sub-task) order by parent id asc.

Then you should be able to use the Export to Excel option to continue with your work.

If you have easyBI, you can eliminate the export to Excel and doing additional work on this. If you need further help, you can contact me.

Mike C November 23, 2016

Hi Guhan,

Thanks, and I tried something like that, but the result is an error message saying "Not able to sort using field 'parent'.". 

I don't believe the field "parent" will be populated for the "Task" issues (someone please correct me if I'm wrong about that).  If so, then even if this JQL wasn't throwing an error, then you still couldn't simply order by parent, because the users want to see each task followed by its subtasks in the output, and if parent is empty for all issues of type "Task", then that won't happen.

 

Deleted user November 23, 2016

Mike, if the sub tasks are linked with parent using the Link issue option within the related Parent tasks, you should be able to see the parent id in search results (or you can enable the column to be visible). The name of the column may be parent link or parent id, whatever configured by your admin. But the concept is the same. If you can click on the Column option on Issues search screen, you should be able to spot the column that I am referring here.I do have SQL queries that can do the job, but it is not the best way to approach when we have options to do easily.

 

Suggest an answer

Log in or Sign up to answer