Forums

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

Writing a JQL query for stories in specific Epic

Vamsi Fragale June 4, 2024

How can I write a query where I can list all stories under an Epic, where each epic Summary has a specific prefix.

4 answers

1 vote
Hannes Obweger - JXL for Jira
Atlassian Partner
June 6, 2024

Hi @Vamsi Fragale,

unfortunately, this is trickier than one might think; as a hierarchical query, it would really require some kind of "join" or "subquery", which isn't available in plain Jira/JQL.

A few directions forward:

  • If it's a one-off thing, you could first query the relevant epics, and then use the keys of these epics in a second query, in an "parent in (KEY-1, KEY-2, ...)" clause.

If you want to run your search dynamically, without manually "stitching" two queries together, you'll need extra tooling:

  • You might be able to use Jira Automation to "propagate" epic information down to the epic's children, and then use the respective field(s) on the children to include them into your filter. Obviously, this will add a fair bit of complexity to your system.
  • There's different apps from the Atlassian Marketplace that can help with that. First, there's a number of apps that extend JQL by additional functions, including hierarchy-related functions.  I've used JQL Search Extensions a few times and it works well.
  • Alternatively, you could try one of the more hierarchy-focused apps from the Marketplace. These apps typically have their own ways of figuring out parent/child relationships between issues, and provide more powerful ways of searching through issue hierarchies. I myself work on such an app, in which your use case would be easy to solve - I'll provide more details below.

Hope this helps,

Best,

Hannes

Hannes Obweger - JXL for Jira
Atlassian Partner
June 6, 2024

Just to expand on the last point, this is how this would look in the app that my team and I are working on, JXL for Jira. Put simply, you'd create a sheet with all issues that are potentially relevant to you, enable the default issue hierarchy (that's just one click), and then use JXL filtering capabilities to narrow down to the issues that you care about:

epic-stories-for-epic-summary.gif

Once you have your list of issues, you can work on these directly in JXL (much like you'd do in e.g. Excel or Google Sheets), trigger various operations in Jira, or export them for further processing.

Any questions just let me know!

0 votes
Darren Ching June 11, 2024

Hi @Vamsi Fragale

If your project is company-managed, you may be able to display the issues using this JQL query in native Jira:

parentEpic in (EPIC-1, EPIC-2, EPIC-3, etc.)

This would only work if there aren't too many Epics, or if you don’t mind maintaining that list from time to time. The query will provide you the Epics as well as their issues and tasks under them.

With Hierarchy (an app that my team and I are working on), this is easily doable by just adding a Quick Filter with the following JQL:

issuetype="Epic" AND summary~"Prefix”

What this does behind the scenes is grab all your Epics which contain the specified prefix. Then, it displays all their children issues as long as you have the “Show all child issues” option enabled. Here’s an example with "User Experience" as the prefix:

ShowEpicAndIssues.gif

If you need any help, feel free to reach out to me or our Support channel anytime, will be happy to help!

0 votes
Charlotte Santos -Appfire-
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.
June 5, 2024

Hi @Vamsi Fragale 

I’m Charlotte, a support engineer at Appfire and I’m here to help you.

Unfortunately, natively, you’ll not be able to do it dynamically.

In the app where my team works, JQL Search Extensions for Jira, you can use this query to get all stories under an Epic whose Epic summary has a specific prefix:

issue in childrenOfEpicsInQuery("summary ~ 'Test'") AND type = Story

Please contact our support if you have any other questions about this query.

We’ll be happy to help you!

0 votes
Kalyan Sattaluri
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.
June 4, 2024

Hello @Vamsi Fragale 

Such queries are not available OOTB.

Do you know if you have scriptrunner add-on available?

Vamsi Fragale June 4, 2024

Thanks for your response, Kalyan, but no, we don't have scriptrunner 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events