Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to write query to find all user stories under different epics

Murali Krishna Nagasuri
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 28, 2025

Hi All,

I have 10 epics, out of that 5 epics having label value "sales", I want to find all the user stories under those 5 epics having the label "sales". I tried with childIssues() function but it doesn't work search criteria. Please share the query if anyone aware of,.

4 answers

2 votes
Rudy Holtkamp
Community Champion
January 28, 2025

Hi @Murali Krishna Nagasuri & welcome to the community,

Out of the box you can't find these with a so-called subquery. For that you need to install an app e.g. ScriptRunner.

With out of the box Jira you need to do this in two runs:

1. Find all epics with label 'sales':

issuetype = epic and labels = sales and resolution is empty

2. With the keys you get back you can do

  issue in portfolioChildIssuesOf("EPICKEY-1") or
 issue in portfolioChildIssuesOf("EPICKEY-2") or 
issue in portfolioChildIssuesOf("EPICKEY-3") or
.... )

So far from ideal, because with every new epic you need to update the second JQL.

 

Workaround

With Automation for Jira you would be able to mark all child issues under an epic with label sales, e.g. by labeling them 'epic-sales'. Then you can run a simple JQL .

0 votes
Layssa Souza
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2025

Hi , @Murali Krishna Nagasuri 

 

If you have scriptrunner use the following query: 

issueFunction in issuesInEpics("labels = Sales") AND issuetype = Story

 

If you don't have ScriptRunner (Alternative without plugins)
Unfortunately, Jira Cloud doesn't allow direct hierarchy queries without plugins, but you can do a manual step using two queries:

First, find the epics labeled "sales":

project = PROJECT AND issuetype = Epic AND labels = Sales

 

Write down the epic codes (example: EPIC-101, EPIC-102, etc.).

Now, find all the stories associated with these epics:

 "Epic Link" in (EPIC-101, EPIC-102, EPIC-103, EPIC-104, EPIC-105) AND issuetype = Story

 This will list all stories about singles that have the "sales" label.

 

I hope the matter is resolved!

Best Regards.

0 votes
Prosper Agwegiokhe January 29, 2025

Hi @Murali Krishna Nagasuri,

I'm Prosper, a Support Engineer at Appfire, and I'm here to assist you.

If you're open to a plugin suggestion, I recommend trying our app, JQL Search Extension for Jira.

You can use the following query to return direct child issues (stories) of epics that have the label "sales":

issue in childrenOfIssuesInQuery("type=Epic and labels=sales")

For more details on this query, you can refer to this resource or reach out to our support team. We're happy to help!

Best regards,
Prosper

0 votes
Ashish Bijlwan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2025

Hi @Murali Krishna Nagasuri 

Welcome to Atlassian Community!

You can achieve this using third party app named Script Runner Enhanced Search. Here is the query for that:

issueFunction in childrenOf("type = EPIC and Labels = Sales")

 

Regards,
Ashish

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events