I’m cleaning up my JIRA project and need a native JQL solution. I’m trying to query open subtasks whose parent issues are closed, without using any plugins. I tested a query like this:
project = OURPROJECT
AND issuetype = Subtask
AND status not in (Closed, Done)
AND parent in (status = Closed)
Unfortunately, it fails because JQL doesn’t support a ‘parent’ function. Does anyone have an alternative approach for this scenario? Thanks for your help!
I’ve encountered this exact problem before, and it can be frustrating. Here’s a workaround that worked for me:
project = YOURPROJECT AND issuetype = Subtask AND status not in (Closed, Done) AND issueFunction in parentIssueFunction('status = Closed')
This query uses the issueFunction and parentIssueFunction, which are often overlooked but incredibly useful. It first finds all closed parent issues, then checks for their subtasks that aren’t closed.
One caveat: make sure your JIRA instance has these functions enabled. Some admins disable them for performance reasons. If it’s not working, you might need to chat with your JIRA admin.
Also, keep in mind this query might be a bit slower on large projects. I usually run it during off-peak hours if I’m dealing with a massive cleanup.
While JQL doesn’t have a direct ‘parent’ function, you can achieve what you’re looking for with a slightly different approach. Try this query:
project = OURPROJECT AND issuetype = Subtask AND status not in (Closed, Done) AND parentIssue in (select issuekey from issue where status = Closed)
This query uses a subquery to first select all closed parent issues, then finds subtasks that are still open. It’s a bit more complex, but it should work without any plugins. Just make sure to replace ‘OURPROJECT’ with your actual project key. Hope this helps with your cleanup efforts!