In JQL, how do I query for Epics with no child Issue Links?

will_cummings December 22, 2020

I have a query where issuetype = Epic (and other stuff, like labels), but want to see only those Epics that have no Stories ("Issues in Epic") yet linked.  How do I specify that?

I only see "Epic Link" in the list of fields to query on, which is not the correct direction - it would work for Stories that lack a parent Epic.  What I want to find is the other way around.

This is my query (with some names changed for security).  Highlighted is the part that needs the correct field name (or completely new approach?) 

(project in "My Project Name") and ((issuetype in (story, bug)) or (issuetype = epic and "epic link" is empty)) and status != Cancelled

Should also mention that I am grouping by epic.  This gives me epics and child stories under them... but I want to pick up the epics that don't already have stories too.

Thanks!

4 answers

2 accepted

2 votes
Answer accepted
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 22, 2020

Hi @will_cummings,

Disappointing as it may seem, there is no JQL search available to retrieve these data in vanilla Jira. There are marketplace apps available that may help you extend search capabilities, and if you often depend on issue links and other parent-child related searches it my well be worth looking into those. Here is a link to the marketplace that may get you started.

Depending on why you would want to find these Epics, you might use the roadmap to as a workaround to simply identify those Epics. An Epic without child issues is displayed there without a progress bar below it and it also doesn't have this > indicator that allows you to expand:

Screenshot 2020-12-22 at 23.42.56.png

in the above example, AG-2 has child issues while AG-4 hasn't.

The roadmap is available in next gen projects and can be activated for classic projects as well from Board settings > Roadmap (beta)

will_cummings December 22, 2020

Ah!  OK, thanks Walter.  I may have to go the plug-in route, if such a plug-in exists.

This is what I am trying to ultimately achieve (see screenshot).  Without the "OR" clause, I get only the top three (because they each have child Stories).  With the "OR" clause, I get the original 3 repeated, plus the two that don't yet have children.  Want the top three and the bottom two - preferably all at the same level, so that when I expand them all, I get the Epic/Story hierarchy shown properly.

2020-12-22_16-04-42.jpg

Like Walter Buggenhout likes this
will_cummings December 22, 2020

Hi @Walter Buggenhout - I found a possible plug-in candidate, and have applied to the powers that be to determine whether we can get it.  Thanks for the tips and the link to the Marketplace.  Much appreciated.

Like Walter Buggenhout likes this
Walter Buggenhout
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 22, 2020

Hi @will_cummings,

Thanks for sharing that screenshot from Structure. You didn't mention you were trying to build a hierarchy there. In that case, it may be worth looking into the documentation of how you can build your hierarchy with Insert and Extend generators: it is not necessary to build your entire structure from a single query, but rather add issues level by level.

You may obviously still run into the same JQL issue to exclude Epics without child issues, but you'll have more control over your structure hierarchy.

Have a look at the documentation of Structure Automation. And more specifically:

Like Dave Rosenlund likes this
will_cummings December 23, 2020

@Walter Buggenhout  - Thank you Walter.

It turns out that I cannot install plugins beyond what has been officially blessed by my company.  Thankfully, they have the ScriptRunner plugin, and  someone much more familiar than I suggested a solution for me, which will suit my present needs.  It looks like this:

project ="Prometheus CPD-DMS" and (issuetype in (Story, Bug) OR (issuetype = epic AND issueFunction not in hasLinkType("Epic-Story Link"))) and status != Cancelled order by sprint, key

Thanks again for your help!

Like # people like this
1 vote
Answer accepted
Shay Levy November 18, 2021

I am not sure if this is still relevant but i was coming across this thread when trying to solve similar issue.

After a few attempts i've used the following and it gave me Epics with no issues under:

type= Epic and issueFunction not in epicsOf("type in (task,bug,Sub-task)")

Patrick S
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 13, 2023

This is indeed the simplest JQL (that I am aware of) for finding epics with no child items. It requires having the ScriptRunner plug-in installed.

Note that in large Jira instances, you will hit performance issues by simply using the type in the inner query. (Note that I also removed sub-task from the inner query, because sub-tasks cannot have an Epic parent link).

type= Epic and issueFunction not in epicsOf("type in (task,bug)")

If you try this method, and find that it is slow, you can add some additional parameters to the inner query to reduce the inner results, and thus the response time.

For example, you can filter on specific projects, the reporter being the currentUser(), etc:

type= Epic and issueFunction not in epicsOf("(project in (Project1,Project2) or reporter = currentuser()) AND type in (task,bug,etc)")
Like will_cummings likes this
gperrego June 13, 2023

I'm trying to do something similar.  I'm trying to identify Epics that do not have a child that has a particular label.  So I'm am querying for the absence of a label on a child.  Can I build on this JQL to do that?

Patrick S
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 14, 2023

@gperrego You sure can.

First, we need to find our inner query. Bugs, Stories, etc that have the label in question. Like the prior response, if you have a large Jira instance, I recommend filtering on project first for performance reasons in the inner query.

Project IN (project1, project2)
AND type in (Story,Bug,etc)
AND labels IN (YourTargetLabel1,YourTargetLabel2)

From there, we can look for epics, that are not parent epics of the issues that have the label.

So, the query below could be modified to include your projects, issue types, and labels in scope to find epics that do not contain any issues with the target label.

type= Epic
and issueFunction not in epicsOf
("
Project IN (project1, project2)
AND type in (Story,Bug,etc)
AND labels IN (YourTargetLabel1,YourTargetLabel2)
")

 

Averil Stewart July 27, 2023

Super helpful - thank you :-)

2 votes
Mike Alexander November 7, 2022

It appears you can use "Parent Link" is EMPTY (in the latest Jira Cloud at least).

Elka Paniagua June 1, 2023

Thanks, Mike! This was simplest approach for our project to id epics that needed immediate attention. 

Patrick S
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 13, 2023

This is helpful in finding the inverse of the original request (finding Jira issues with no epics). The response from Shay Levy is a simple way to find epics with no child items. It requires the ScriptRunner plug-in.

0 votes
Joshua Carr December 22, 2020

I'm no expert on this, but here's a related post I found: https://community.atlassian.com/t5/Jira-Software-questions/JIRA-Need-count-of-stories-under-an-epic/qaq-p/961579. The idea that led me to that page was that there might be a variable for the number of issues in an epic, in which case you could just look for epics with 0 issues. There doesn't seem to be anything easily accessible, though; everything I saw suggested involves scripting or similar.

Perhaps something has been developed in this area recently, but from what I can see, there are solutions, just nothing especially simple.

will_cummings December 22, 2020

Thanks Joshua.  I will explore that option.  I've only been exposed to Jira for two weeks now, and am trying to come up to speed rapidly - along with my "normal" job of requirements analysis on a software project.

I'm thinking that something scripted will not be allowed - unless I can get "the powers that be" to agree.  But, not sure.  Maybe someone else will have an additional answer.

Suggest an answer

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

Atlassian Community Events