'Query to get all subtasks associated to stories with some labels in Jira

I have user stories in Jira with some labels A,B,C for example. But at subtasks level there is no labelling .Now I need to fetch count of all user stories of that label, their tasks and subtasks.

How can I get subtasks which have no labels but linked to labelled user stories.



Solution 1:[1]

Hi you can use the following JQL if you have scriptrunner;

( issue IN subtasksOf('type=Story and labels in (label1, label2)') or issueFunction in linkedIssuesOf('type=Story and labels in (label1, label2)')  ) and labels is EMPTY

It both finds the subtasks and linked issues of the story labeled as label1 and label2. It also filters the issues with own labels...

Solution 2:[2]

issuetype in (Task-Agile, Sub-task) AND issueFunction in subtasksOf("Issuetype = story")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kemal Kaplan
Solution 2 Sohag Miah