JQL - Epics associated with set of Stories

Kelley Cooper November 1, 2017

Is there any way, without Script Runner, to return a list of all Stories meeting certain criteria AND their associated Epics?

For example, I want to return all the Epics associated with Stories where Team = X.  This seems so simple, but yet I can't seem to figure it out!  There has to be some way to do this, else you have to use a common element on both Epics and Stories in order to populate an agile board with both Epics and Stories.

If it's not possible without Script Runner, then how do I achieve this with Script Runner?

6 answers

1 accepted

1 vote
Answer accepted
Steven F Behnke
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 1, 2017

Sorry: This is not possible out of the box. It's quite annoying, but it's true. There is a long standing improvement requests that I think you'll find interesting: 

To sum the current state of affairs: Out-of-the-box you can only search issues links one depth down, and can filter by type, with "linkedIssues()" jql function. Please see the documentation:

It should be noted that Atlassian recently resolved JRACLOUD-59181, however it's Server counterpart hasn't been released yet. This means that there is an additional function in Jira Cloud: "parentEpic()", which additionally returns subtasks under the issues returned by the epic-story link type. "linkedIssues()" incorporates this functionality.

Now, ScriptRunner is not neccessary per-say: It's simply commonly used and a by-product of the power of that plugin is functions like the ones you see suggested elsewhere. There are plenty of plugins that allow for the ability to search by link type, and you can trial them all for free

As far as ScriptRunner goes, the documentation you're looking for is here: https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_linkedissuesof

Kelley Cooper November 2, 2017

Thanks, Steven.

So how am I supposed to create a filter which populates a board with both Epics and Stories/work items?  Up to now we have used

project = <Project name> ORDER BY Rank

which retrieves everything, then we use Quick Filters to filter the work items by scrum team.  But our boards are starting to return 1000s of issues and become non-performant.  We couldn't be the only ones facing this issue...

The only way we can determine to populate a board with both Epics and work items is for both types of the items to have something in common...which is counterproductive.  I just can't bring myself to believe that I can't use a board effectively unless I purchase and $$$ plugin.

Steven F Behnke
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 2, 2017

Foremost: If you have 1000s of issues in your product backlog, this is a problem. A product backlog typically has 100-400 tickets, 1000s is beyond the scale of an Agile Team, which a board is supposed to represent.

I ran into this problem with an Aerospace customer: They wanted to use Agile Boards for Hardware Tracking: The boards were not performant at 1000 issues much less 5k they were trying to use. 

The fact is that they are using the tool WAY outside the intended use-case, so it's no surprise it doesn't work. It sounds like you're in the same boat: Agile teams DO NOT HAVE 1000s of issues in their product backlog. It's wrong. You can't use the board effectively because you're scaling it wrong. From my expert perspective, this is working as intended.

Secondly, you can't do what you want out of the box. You should buy a plugin. I can hardly see how JQLTricks is $$$: It's affordable and the price scales well for license sizing. Are you telling me that a $500 or $1000 purchase won't work for you? 

Finally, the fact is that this product was made for certain use-cases: When you step out side those use-cases (agile development, in this case), then you can't possibly expect the product to just 'work' for you. Jira is extraordinarily flexibly but that doesn't mean you can throw a bunch of shit at it and expect it to work perfectly. Either use Agile Boards for Agile Development or seek alternatives.

Steven F Behnke
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 2, 2017

If you tell me whether or not you're on Server or Cloud, and what license size you have, I can recommend an affordable plugin. 

Kelley Cooper November 2, 2017

Thanks for the feedback and your time, Stephen...it is much appreciated. :)  We are JIRA Server 7.2.8, license size is 10,000.

I think I confused you at some point in my question.  We don't have scrum teams with 1000s of issues in their backlog....we have boards with 20+ scrum teams who have 200ish issues in their backlogs.

Up to now, we have used the following type of filters to populate our boards because this was all we could do out of the box:

project = <project name> ORDER BY Rank

This creates a board that displays Epics and Stories (perfect), then we use Quick Filters to filter the board by scrum team.  Our boards sometimes contain the backlog for as many as 20 scrum teams as some of our products are quite large (our scrum teams don't individually have 1000s of issues - but if you add up 20 teams with 200 issues you see where we are headed). 

Up to now, our boards have NOT been team-specific as you indicate above, but we are going to have to move in that direction because of the sheer # of scrum teams we have working on some of our products.  The problem is that in order to get Epics AND Stories to display on a board we either have to

1. use a filter that returns all the issues in a project (which we currently do, see above, but this is becoming a performance issue for us because of the # of scrum teams) OR

2. create a board for each scrum team (which is where we are headed) which displays both Epics and Stories.

We can't figure out how to create a filter to do #2 out of the box UNLESS we assign both the Epics and the Stories to the scrum team - and that is not agile and we don't want to go there.  When I said $$$ I was referring to Script Runner, which at $8000 we consider pricey just to get #2 to work.   

Steven F Behnke
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 2, 2017

Thank you, I understand better. I'm working now but I'll loop back tonight and try to help you solve this. 

Steven F Behnke
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 3, 2017

Foremost: It's expensive but you'll probably find that Portfolio for Jira is a good investment. My company likes it so far and we also have a 10k user license. This let's you use a Team field that is inherited by the appropriate structure.

You could also develop some functions to help you do this sort of thing, the development API is really quite straight-forward.

Outside of the development API, there's Misc Calculated Fields, Supported and Free. https://innovalog.atlassian.net/wiki/spaces/JMCF/overview#JIRAMiscCustomFields-calculatedtextfield, perhaps you could work something out with that.

JQLTricks does what you ask for much less money: https://marketplace.atlassian.com/plugins/com.j-tricks.jql-plugin/server/pricing and as a long-time user I stand by it. 

I looked around, and outside of a maybe possible solution with Misc Calculated Fields, there's no free existing plugins that offer JQL solutions, at least as far as some looking on marketplace went.

Prem Chudzinski _extensi_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
November 3, 2017

@Kelley Cooper

We've created a plugin that will fix some of your issues

1. Epic, Versions filtering - by project or name

 

02.Backlog.png

2. Performance issues on large boards

Have a look at this video 

https://extensi.io/video-tutorials/agile-board-filter-jira-software/board-load-time-optimisation

 

3. Private Quick Filters - each team can have a set of  private Quick Filters populated by the board administrator

https://extensi.atlassian.net/wiki/spaces/ABF/pages/29757174/Private+Shared+Team+Filters

 

Soon will be adding some new features that will allow you to restrict epic list easily

  • We will add full JQL filtering soon for both versions and epics.
  • Some new functions like restrict visible issues to epics and restrict epics to issues 
Kelley Cooper November 3, 2017

Thanks again, Stephen.

I didn't mention it above, but the reason we are trying to determine how to create a filter which

returns a list of all Stories having scrum team = 'x' PLUS all the Epics and Subtasks associated with those Stories

is to create a board we can use as an Issue Source in a Portfolio plan.

It appears we already have set aside funds to purchase Script Runner in the coming month so am assuming that is how we will create the JQL we need to support these boards.

We are just trying to determine what the script would be to return what we need...

Steven F Behnke
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 3, 2017

Wait, what? You have portfolio? What is the team field missing?

Kelley Cooper November 6, 2017

We've been using JIRA for 12+ years; when we started Agile, Jira didn't provide (and still doesn't) a built-in field we could use to link issues to scrum teams, so we created a custom field (called Teamlet). 

Yes, we recently purchased Portfolio so we were trying to figure out the best way to create Boards by scrum team so we can use those as Issue Sources.  This presents us with 2 problems:

  1. determine how to create Boards that returns all the Stories associated with a particular scrum team AND all the Epics and Subtasks associated with those Stories - so we can use that Board as an Issue Source for Portfolio.
  2. determine how we are going to go from using our team custom field to the Portfolio Team field

I think we figured out #1; this JQL, available via Script Runner, seems to do the trick:

project = <project> AND Teamlet = <team name> OR issueFunction in subtasksOf("project = <project> AND Teamlet = <team name>") OR issueFunction in epicsOf("project = <project> AND Teamlet = <team name>")

#2 we are working on now...as far as we can tell, standard Jira only recognizes shared teams from Portfolio...and if we attempt to edit the Portfolio Team field in standard Jira the Team list displayed includes ALL the shared Teams from Portfolio.  This is far from optimal as the list could include 100s of values.

0 votes
Hung Nguyen June 13, 2019

Today, WITH scriptrunner, this can be done by the jql

issueFunction in epicsOf('Team = X'))

0 votes
Prem Chudzinski _extensi_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 31, 2018

Hi @Kelley Cooper,

 

we've implemented the feature you were looking for

now you can filter out stories where Team is X and see all related epics directly on the backlog 

more details http://go.extensi.io/nl2/6phl/18h93.html

 

sync.gif

0 votes
Domenico Manzo _Actonic_
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 2, 2017

You could all stories involved in Epics (it is built-in JQL of ScriptRunner):

issueFunction in issuesInEpics("filter=EpicsList")

  

Kelley Cooper November 2, 2017

Yes...but I want to return a list of Stories (a subquery) AND all the Epics associated with those Stories. 

The JQL you list only returns the Stories...I don't get any Epics.

0 votes
Steven F Behnke
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 1, 2017

duplicate

0 votes
Steven F Behnke
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 1, 2017

duplicate

Suggest an answer

Log in or Sign up to answer