JQL (with scriptrunner) to filter all items where an Epic has stories/tasks associated with a sprint

jira_kung_fu
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!
February 27, 2023

Hi - sorry for the long title!

I need to return all items, whether they are Epics, Stories, Tasks or Bugs but I only want to show items which are assigned to Sprints.  This would be simple but our Epics are not assigned to Sprints.

Is it possible to find all tasks/stories/bugs which are assigned to sprints and include in the dataset the associated Epics (which are not assigned to sprints). 

 

This would exclude Epics which have no sprint tasks assigned and also exclude tasks not assigned to Sprints.

We have scriptrunner if this makes it easier.

 

Thanks in advance!

1 answer

0 votes
Peter-Dave Sheehan
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.
February 27, 2023

With the "EpicOf" jql function provided by scriptrunner, you can do the following:

project in (AAA, BBB, CCC) AND (type in (Story, Task, Bug) OR issuefunction in epicsOf("project in (AAA, BBB, CCC) and type in (Story, Task, Bug)"))

It's best practice to include a project filter in the sub-query to limit performance impact. 

Suggest an answer

Log in or Sign up to answer