How to refer issues inside epics using JQL without hard coding

Preeti Singh
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!
March 28, 2024

I am trying to automate my filters to get list of issues within multiple epics. Currently i have hardcoded the epic numbers in the JQL. I am looking for a way to automate or dynamically get this information and avoid manual addition of epic numbers each time my team creates a new epic. 

I am able to get the list of epic names dynamically by referring to  matching label name.  But i am not able to get to issues inside the epics.  can u please help here. 

2 answers

0 votes
Stephen Wright _Elabor8_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 29, 2024

Hi @Preeti Singh 

There's no native JQL option for this, as it's sub-querying. IE...

  • Get a list of issues, where the parent Epic...
  • ...has a specific piece of metadata (like a label or component)

You'll need an App to extend the power of JQL to do this - such as...

---

Natively, you'd need to have metadata at the child issue level that JQL could refer to.

You could do this using Automation - then you could have multiple rules such as...

  • Rule 1...
    • If a child has an Epic parent added
    • And the Epic has "Label 1"
    • Copy this Label to the child's Labels
  • Rule 2...
    • If an Epic has "Label 1" added
    • Then copy this Label to all child issues
  • Rule 3...
    • If a child issue has the Epic parent modified
    • And the new Epic does not have "Label 1"
    • Remove it from the child's Labels

...then you could refer to the Label in JQL as it's at the child level.

---

Let us know your thoughts! If you think the Automation Rule(s) would work, and you'd like help creating them, we'd be happy to help :)

Ste

0 votes
Hannes Obweger - JXL for Jira
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
March 29, 2024

Hi @Preeti Singh,

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.

For one-off use cases, I'd recommend exactly what you're doing, i.e., to first search for the relevant the epics, and then list the epic keys in a "parent in (KEY-1, KEY-2, ...)" query.

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. Scriptrunner and JQL Search Extensions are popular, but there are also others.
  • 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
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
March 29, 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:

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!

Suggest an answer

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

Atlassian Community Events