Forums

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

What JQL finds all stories within Epics that have a certain label

Adam Waites
Contributor
August 11, 2023

Hi,

I am looking to create a JQL that will allow me to find all the stories that are linked to a set of Epics that have a specific label. These Epics will continue to be created, so I cannot enter the Epic Name/Key within the filter.

Example

Epic: ABC-123 (label of ABCD1234)

Story: ABC-124 (no label)

Story: ABC-125 (no label)

Story: ABC-126 (no label)

 

I want the query to return those stories. We are likely to have approximately 50-80 Epics with the label 'ABCD1234' so cant list them all. 

4 answers

1 accepted

1 vote
Answer accepted
Sayed Bares _ServiceRocket_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 11, 2023

@Adam Waites I think this is not possible with the native functionality because you will need to run subqueries. If you are open to purchasing an app then this should be possible.

Adam Waites
Contributor
August 11, 2023

Ok, thank you

1 vote
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.
August 14, 2023

Hi @Adam Waites 

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

Unfortunately, using JQL of Jira, you’ll not be able to do it dynamically.

But with JQL Search Extensions for Jira, you can use this query to find all stories within Epics that have a certain label:

If it's a parent-child relation

issue in childrenOfEpicsInQuery("labels=ABCD1234") AND type = Story

Or this one, if it's a linked issues relation

issue in linkedIssuesOfQuery("project=ABC AND type=Epic AND labels=ABCD1234") AND type = Story

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

We’ll be happy to help you!

Best regards,

Charlotte

Adam Waites
Contributor
August 29, 2023

Thank you for the response on this. Much appreciated

0 votes
karim -Atlassway-
Banned
November 22, 2023

Hi @Adam Waites 

Using Colored Label Manager  you can see at a glance how often labels are being used

and Manage your labels globally or per-project

0 votes
Hannes Obweger - JXL for Jira
Atlassian Partner
August 13, 2023

Hi @Adam Waites

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:

  • 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. Scriptrunner has been mentioned before; 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
August 13, 2023

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:

epics-by-label.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!

Adam Waites
Contributor
August 29, 2023

Thank you very much. Very useful to know

Suggest an answer

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

Atlassian Community Events