How to find Jira work items with no sub-tasks
Short answer
Jira Cloud's JQL can find work items that are sub-tasks or that have a parent, but it cannot find work items that have no sub-tasks, count children, or filter a child by its parent's status or assignee. The hasSubtasks() function people remember comes from scripting apps, not from Jira.
What JQL can and cannot do with parents and children
| Query | Result on Jira Cloud |
|---|---|
parent = ABC-123 | Valid. The children of one work item (sub-tasks, or the work items under an epic). |
parent is EMPTY / parent is not EMPTY | Valid. Work items without or with a parent. |
issuetype in subTaskIssueTypes() | Valid. All sub-tasks. |
subtasks is EMPTY | Invalid: "Field 'subtasks' is not searchable." |
issueFunction in hasSubtasks() | Invalid without a scripting app: "Field 'issueFunction' does not exist or you do not have permission to view it." |
So you can go from a parent to its children, but not ask "which parents have none", "which parents have all children done", or "which children belong to a parent that is In Progress". Atlassian's requests for these, JRACLOUD-67108 and JRACLOUD-18839, list no workaround.
Workaround: count children with Automation
- Create a number custom field, for example "Sub-task count".
- Create a rule triggered by Work item created, with a condition that the work item is a sub-task.
- Add a Lookup work items action with
parent = {{issue.parent.key}}. - Branch to the parent and set the field to
{{lookupIssues.size}}.
Limits: it does not backfill existing parents, so parents that never had a sub-task keep an empty field rather than 0 (search "Sub-task count" is EMPTY as well). You need more rules for deleted or moved sub-tasks and for status changes if you want an open count, and each run counts against your monthly rule-run allowance.
With an app: child and parent fields
Parent & Child Fields for Jira (ours) maintains six read-only fields: Child count, Open child count, Child progress %, Parent status, Parent status category and Parent assignee. They backfill on install and update within seconds when work is created, moved to another parent, reassigned or changes status.
"Child count" = 0 AND issuetype = Story
"Open child count" = 0 AND "Child count" > 0 AND statusCategory != Done
"Parent status category" = Done AND statusCategory != Done
"Parent assignee" = currentUser()
"Child progress %" < 50 AND duedate < 7d
The second query finds parents that are ready to close; the third finds open children of finished parents. Scripting suites such as ScriptRunner and JQL extension apps offer functions for some of these searches too, at a higher price and with a function syntax rather than fields you can show as columns.
Common questions
Does this work for epics as well as sub-tasks?
parent = KEY works for both in Jira Cloud. The app's Child count includes sub-tasks and the work items under an epic.
Can I show the parent's status as a column?
The native Parent column shows the parent's key and summary, not its status. A stored "Parent status" field can be added as a column and used in JQL with =.