Finding stories whose epic matches a certain criteria

Brandon Toms
Contributor
November 11, 2024

Hey folks!

So I'm trying to put a query together to find Jira stories linked to epics that have a particular component ("ENABLEMENT" in this case).  Something kind of like this:

IssueFunction in IssuesInEpics("Component = \"ENABLEMENT\"")

I've wracked my brain on it for hours now, anybody got a solution?

Thanks in advance!

Brandon

2 answers

1 accepted

0 votes
Answer accepted
Salih Tuç
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.
November 11, 2024

Hi @Brandon Toms ,

From my point of view, you already nailed it man! If you have ScriptRunner, there is a JQL Function called issuesInEpics so you can call it exactly like you mentioned:

 issueFunction in issuesInEpics("Component = \"ENABLEMENT\"")

Are you stucking at another point? Can you please give more details if the problem exists?

Brandon Toms
Contributor
November 26, 2024

Nope, that did it, I just had my syntax screwed up. :-D  Thanks!

0 votes
Hannes Obweger - JXL for Jira
Atlassian Partner
November 14, 2024

Hi @Brandon Toms

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 ""Epic link" 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. The syntax that you're using in your message looks like it would come from Scriptrunner. Do you have the app installed?
  • 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
November 14, 2024

... and 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

(I'm using labels here, but it would work the same way with components, too.)

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!

Brandon Toms
Contributor
November 26, 2024

That's great, Hannes, thank you!

Suggest an answer

Log in or Sign up to answer