Search code examples
jirajql

Query/filter to return child issues from a list of active parents (EPICs)


I'm looking for a JQL query/filter to return a list of child issues from a list of active parents (EPICs).

For example:

"Epic Link" IN linkedIssuesInQuery("issueType = Epic AND Status = 'In Progress'")

I was hoping the above query would work, but the results are not what I expected. Is there a way in standard JIRA (no plugin) to return a list of all child issues of a Query/Filter set?

I also tried a filter, but the results were the same as above:

"Epic Link" IN linkedIssuesInFilter("1234")
// Where Filter Id 1234 was something like => issueType = Epic AND Status = 'In Progress'

Both examples above return results, however they seem to be incomplete results and I don't understand why some issues not not being returned.

ps. The function childIssuesOf("ABC-123") returns the correct results for a single parent issue, but how do I provide a dynamic list of parents, not just a static hardcoded issue number?

EDIT: After a lot more experimenting and reading, I found that the JIRA instance I am using has a Plugin called JQL Tricks. This Plugin has a function which, based on its description, is exactly what I need: parent(JqlQuery) ... but it doesn't work!

Here is my test query:

issue in parent("project in (MyProject) and status = \"In Progress\" and issueType = EPIC")

This query returns 0 results! However when I cut out the JqlQuery within parent and run it on its own, I get the complete list of EPIC's I expect to see and when I review the EPIC's they all have child issues. From all the experimenting I have done with this function, I believe there is an issue with the status "In Progress" (and also "Open") as when I try the call with other status types the child issues are return as expected. I have also tried a different approach for filtering for In Progress

issue in parent("project in (MyProject) and status not in (closed, refused, new, open) and issueType = EPIC")

However the result is exactly the same as above, 0 results! Finally I have also experimented with the function subtask(JqlQuery), also without success.

Can anyone help?


Solution

  • In JQL Tricks, parent and subtask JQL functions work with parent/child (subtask) link type. You might want to search for "issues in Epic" link type, i.e. using the "Epic Link" field.

    With JQL Tricks you can try this (be careful about different quotation marks):

    issue in issuesWhereEpicIn('project in (MyProject) AND status = "In Progress"')
    

    Source: https://www.j-tricks.com/jql-tricks-plugin.html [1, 2]

    Tip: (mainly for other users ended here finding the same answer)

    You can also check if ScriptRunner add-on is installed (it's very often installed, too). You can check the presence if issueFunction is available in JQL). With this add-on, you can use this:

    issueFunction in issuesInEpics('project in (MyProject) AND status = "In Progress"')