How to lookup sub tasks for each Sprint under Jira Automation and in Issues
Asked by Ayush Khandelwal:

Sprint in openSprints() and type = Subtask ORDER BY created DESC

I wrote this in the issue navigator and I am unable to fetch results related to the above mentioned query


Answers:
author: Trudy Claspill
body: Hello [@Ayush Khandelwal](/t5/user/viewprofilepage/user-id/5549786)

Welcome to the Atlassian community.

Subtasks get associated with sprints only when their parent issue is associated to a sprint. Do you have any issues in active sprints where those issues also have subtasks?

Are you working with Company Managed projects or Team Managed projects? In your filter you have not specified any restrictions on projects, but it should be noted that the default name of a subtask type issue in a Company Managed project is "Sub-task" with a dash in it. "Subtask" is the name of a subtask type issue in a Team Managed project.

If you want to get all types of subtasks from both Team and Company Managed projects, where the subtask parents are in Active sprints, then try this filter:

sprint in openSprints() and type in subTaskIssueTypes()

comments: author: Ayush Khandelwal
body: Hello Trudy,

Thank you for your reply

**Q1: Do you have any issues in active sprints where those issues also have subtasks?**

Yes, I have issues in active sprints, and I can see the stories, tasks, and bugs. However, I am unable to see the subtasks for the active sprint even though they are attached to the current sprint. The child issues are linked to stories/tasks, and in some cases, stories/tasks are linked to the epic.

**Q2: Are you working with Company Managed projects or Team Managed projects?**

Team-Managed project.

**Q3: In your filter, you have not specified any restrictions on projects.**

I am unable to understand which restrictions you are referring to.

**Q4: sprint in openSprints() and type in subTaskIssueTypes())**

I tried this as well.

Thanks \& Regards,  
Ayush


author: Ayush Khandelwal
body: **sprint in openSprints() and type in subTaskIssueTypes()**

**This exact code**


author: Trudy Claspill
body: Below I will address Q3, but ultimately it is irrelevant. It appears that for Team Managed projects it is not currently possible to search for subtasks included in Sprints. There is a change request about it here:

<https://jira.atlassian.com/browse/JRACLOUD-81069>

I have verified in my own system that when one tries to search for subtask type issues and use the Sprint field in the same JQL, no results are returned.

> **Q3: In your filter, you have not specified any restrictions on projects.**
>
> I am unable to understand which restrictions you are referring to.

Your filter doesn't include criteria to restrict the projects from which you want to get issues. As the filter is written it is looking at ALL projects in your Jira system searching for any issue that has the issue type name "Subtask" that is in an Active Sprint.

If you are interested in a specific project then you should use a query like this:

project=*\<insert your project here\>*sprint in openSprints() and type in subTaskIssueTypes()


author: Ayush Khandelwal
body: One way to utilize them in filters is to modify the subtask workflow by using the sprint name as the status. You can automate the change in status name as Sprint Name based on openSprints().

Subtask are anyways not tracked. Shouldn't be a problem


Tags: cloud

jira-cloud