"How can I write a JQL query to select all stories and tasks that have a given epic link as well as all sub-tasks of tasks or stories that have a given epic link?"The first part is easy ...project = INFRA AND "Epic Link" = Databases ORDER BY Rank ASC... it's the second part that is the real puzzler.Let me start by saying that I've spent quite while Googling on this question already and all the supposed solutions that I've seen require the use of addons. I want to find a solution to the above that DOES NOT require an addon. I think it's a perfectly reasonable to want to create a view (board or whatever) that includes all the items that are hierarchically structured under a given higher level object in the Jira object model. I sincerely hope that this is possible given the base-level capabilities of JQL.How can I do this?
Aha! parentEpic wants the epic key not the epic name!!! That's intuitive. So this works ...parentEpic = INFRA-5So this actually does what I want ...project = INFRA AND ("Epic Link" = Databases OR parentEpic = INFRA-5) ORDER BY Rank ASCOr more specifically this ...project = INFRA AND ("Epic Link" = Databases OR (parentEpic = INFRA-5 AND key != INFRA-5)) ORDER BY Rank ASC... since the first query returns the epic itself. The second query returns just the stories, tasks and sub-tasks.
To add more context, I am using the Jira cloud product
...
I have found references to a JQL function called "parentEpic" ...https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-functions/The examples on that page seem to suggest that this would work ...Find issues and sub-tasks in the epic DEMO-123:parentEpic = Databasesbut when I use that in my Jira instance I get this error ..."The issue key 'Databases' for field 'parentEpic' is invalid."
Hi @adavies - Welcome to the Atlassian Community!
You will need an add-on such as ScriptRunner to be able to get the sub-tasks. See this link for some more information:
https://community.atlassian.com/t5/Jira-Software-questions/JQL-Query-Sub-Tasks-Parent-Epic-or-User-Story/qaq-p/1582188
I refer the honorable gentleman to this quote from my original question ..."I want to find a solution to the above that DOES NOT require an addon"
Duly noted - but I don't believe you will find a solution otherwise. :-)
Oh contraire Blackadder ...
Actually, the "Epic Link" condition is now redundant. These two queries return the same issues ...project = INFRA AND ("Epic Link" = Databases OR (parentEpic = INFRA-5 AND key != INFRA-5)) ORDER BY Rank ASCproject = INFRA AND parentEpic = INFRA-5 AND key != INFRA-5 ORDER BY Rank ASC
INFRA-5 is the key for the epic called Databases
It looks like you're new here. Sign in or register to get started.