In Jira there are two ways to relate issues to each other…
- parent / child – created with the 'Add a child issue' feature
- linked issues – created with the 'Link Issue' feature
In our example we have an Epic (issue key SCR-10) that has both child issues AND linked issues. We're going to see how to search for that Epic and display those related issues, either child issues or linked issues or both.
First, when searching for children (User Stories and Tasks) of a parent (the Epic) we have ….
- Epic SCR-10 that has some User Stories and Tasks created as child issues
- Child issues, which when viewed you see the parent which is the Epic SCR-10
To find Child issues of a parent we can simply use the JQL …
parent = SCR-10
Or to find all the child issues for many parent issues…
parent in (SCR-10, SCR-18)
In our example task SCR-12 (a child task of the Epic) has sub tasks. Our search will NOT list sub tasks related to the child issues. Jira and JQL does NOT support that capability out of the box. You’ll need a plugin like Script Runner for that.
See the post and video “Jira JQL to show all issues and subtasks in the Epic"
Second then, let’s look at, ‘linked issues. Our ‘parent’ JQL statement with our Epic (SCR-10) will not pick up linked issues. In our example Bug SCR-25 is linked to Epic SCR-10 … but doesn’t show with the ‘parent’ JQL!
We need a different JQL search for this. We can use the ‘linkedIssues()’ function. This JQL will pick up linked issues
issue in linkedIssues("SCR-10")
The ‘linkedIssues()’ function searches for issues linked to an issue. When we use this in conjunction with the ‘issues in’ statement it’s saying “get me all issues – from the list returned when using the linkedIssues() function”.
This function also gives us the ability to filter by link type…
issue in linkedIssues(SCR-10, "is blocked by")
The limitation with this query is that it only returns results for one issue. If you want to find linked issues for more than one issue, then again we have to turn to the ScriptRunner app from the Atlasian marketplace.
Anyway, back to what you can do with core JQL. If you want to find ALL related issues … both ‘child issues’ and ‘linked issues’, then you’ll need to use a query that combines both…
issue in linkedIssues("SCR-10") or parent = SCR-10
That JQL will pick up all issues that are related to the parent Epic.