JQL to show all issues AND subtasks in the Epic

I use JQL Tricks to return all issues that have a certain link type. That query is:

issue in parent("issue in linkedAllIssues(CH-58,\"contains the scope\")") OR issue in linkedAllIssues(CH-58, "contains the scope") OR issuekey = CH-58

This returns the issues that have a link type "contains the scope" with CH-58 (CH stands for "charter" by the way).

Unfortunately, it does not get deeper than the epic. So, for example, if it returns epic SF-99, SF-100, and SF-101, it does not return the issues and subtasks belonging to those epics.

Basically, in addition to what is already being returned by the JQL above, I need the JQL to also return any issue and subtasks whose epic link “is scope within” the selected charter.

2 answers

0 vote
Mikael Sandberg Community Champion Aug 09, 2017

You need something like ScriptRunner or JQL Tricks to do nested JQL queries. I have not used ScriptRunner's JQL function for it (we have both plugins), but we are using JQL Tricks to search for all issues and sub tasks that are linked to specific epics.

Thanks. But... can you share the JQL?

Mikael Sandberg Community Champion Aug 10, 2017

Here is a query we use to get all issues linked to a specific epic:

project = X AND issue in issuesWhereEpicIn("project = X AND issuekey = X-XXX")

In your case your query should look something like this (I have not tested it so you may have to tweak it a bit):

issuesWhereEpicIn ("issue in parent("issue in linkedAllIssues(CH-58,\"contains the scope\")") OR issue in linkedAllIssues(CH-58, "contains the scope") OR issuekey = CH-58")

Thank you. I sincerely appreciate the help. When I enter that query into the search box, however, I get an error: 

Error in the JQL Query: Expecting operator but got '('. The valid operators are '=', '!=', '<', '>', '<=', '>=', '~', '!~', 'IN', 'NOT IN', 'IS' and 'IS NOT'. (line 1, character 19)

Mikael Sandberg Community Champion Aug 10, 2017

Okay, so I played around a bit in my test environment and this query works there:

issue in issuesWhereEpicIn("issue in linkedAllIssues(CH-58, \"contains the scope\")") OR issue in parent("issue in linkedAllIssues(CH-58,\"contains the scope\")") OR issue in linkedAllIssues(CH-58, "contains the scope") OR issuekey = CH-58

In my case I use AM Utils (free add-on) to search all issues and subtasks on it:

A simple example:

issuekey in (issuesSubtasks("'Epic Link' = XXX-99")) ORDER BY Rank ASC

With this I can make boards that swinlanes with stories or projects besides the Epic Link. 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

80 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you