Forums

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

How to extract stories from a filtered set of epics

Lara Savon January 26, 2022

Hi - can you please help me with the JQL query for filtering out stories that correlate to certain epics from a filter?

e.g., Filter 1 brings back 5 epics (which have attached stories) How do I then pull the stories out of those epics onto my Kanban?

Right now this is what I have for filter 1 which is working as expected:

project = XXX AND "Epic Color" = ghx-label-14

 

If I try to do filter = "filterName" AND issuetype = Story, it does not work as expected. Also if I add issuetype = Story to the end of my first Filter, it also does not work.

 

1 answer

0 votes
Mark Segall
Community Champion
January 26, 2022

Hi @Lara Savon and welcome to the community!

If I understand correctly, you want to get a list of all stories corresponding to specific epic(s)?  If so, you want something like this:

project = XXX AND "Epic Link" IN(Epic1, Epic2, Epic3, ...) ORDER BY "Epic Link"

Feel free to use/remove ORDER BY.  When querying for multiple epics, I like to have my stories grouped.

Lara Savon January 26, 2022

Hi @Mark Segall --

 

The problem is I dont want to link epic names, as the list of Epics that I want to bring in may change based on the creation of new ones that will go into this same category. Is there a way to filter epics based on color, then bring the stories from those epics in? So this filter will keep working as new epics of the same color are added to my roadmap.

 

Thanks!

Mark Segall
Community Champion
January 26, 2022

Hi @Lara Savon - Yes Epic Color should work in the same way:

project = XXX AND "Epic color" IN(EpicColor1, EpicColor2, EpicColor3, ...) ORDER BY "Epic Color"
Mark Segall
Community Champion
January 26, 2022

I should add that you probably want to add this if you're only wanting to see stories appear:

AND issuetype = Story
Lara Savon January 26, 2022

@Mark Segall Thanks! I inputted:

 

project = X AND "Epic color" IN(ghx-label-14) AND issuetype = Story

But no Stories appeared even though they exist under the Epics. Anything else to troubleshoot?

Lara Savon January 26, 2022

The Epics appear when I remove "AND issuetype = Story", but when I add that portion, no stories appear.

Mark Segall
Community Champion
January 26, 2022

I just realized the issue. Unfortunately, epic color is not relevant to stories and not a field that can be used for hierarchal queries.  As a result, the only way you're going to get your list of stories under epic is by querying against the epic link.  

Lara Savon January 26, 2022

Gotcha - no problem. Would Epic Name be a field that I could use in place of Epic Color? Or creating 2 filters to work together on this?

Mark Segall
Community Champion
January 26, 2022

Epic name can work in the first query I provided. You can use the Epic Name or key in the epic key for "Epic Link":

project = XXX AND "Epic Link" IN("EpicName1", "EpicName2, EpicName3, ...) ORDER BY "Epic Link"
Lara Savon January 26, 2022

Mark - I do apologize for the back and forth, but I have an additional clarifying question.

When I use Epic Name, I'd like to do a "name contains XXX" to pull Epics as opposed to entering in 10 Epic Names + new Epics that will eventually come in and need to flow to this board. Could I do something like --

project = XXX AND "Epic Name" ~ "X" AND issuetype = Story

Mark Segall
Community Champion
January 26, 2022

Unfortunately that isn't going to work because JQL thinks you're looking for issues that are both an epic and a story.  I've dug around a bit and it looks like if you want to go that route you'll need a 3rd party app like script runner.

Suggest an answer

Log in or Sign up to answer