Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there JQL that will group subtasks under tasks?

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

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.

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

Like # people like this

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:

Like # people like this

The command "rank" worked for me. Thanks!

Like Steve Lewis likes this

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

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

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


You made my day! Thanks, works just fine!

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

This one works a treat, thanks Do Quoc!

thanks Do Quoc! exactly what we need!

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.

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.




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.

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.


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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you