Help with filters for child and linked issues

Arif Patel March 1, 2024

Is there a way to pull something like this? 

 

X = KEY-###
for each epic in X Parent issue type,
get all issues
for each of those issues
recursively get all child issues
recursively get all linked issues

2 answers

0 votes
Amay Purohit_RVS
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.
March 1, 2024

Hi @Arif Patel 

If you would like to try out a mktplace app, please take a look at an add-one have developed for the same use case.

Issue Hierarchy 

The app shows your issues , their subtasks and the linked issues as well in a simple and easy to use tree view, with progress at each parent level.

Disclaimer : I am part of the team which developed this app

Links Hierarchy - Gadget.PNG

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 1, 2024

Hello @Arif Patel 

Do I understand correctly that you have a custom hierarchy like this?

Custom Parent Issue Type
|-- Epic
|-- child issues

Are you using a Jira Premium subscription where you have modified the Issue Type Hierarchy? And are you specifying the key of the Custom Parent Issue Type in the Parent field of the Epic?

If so, you can get all the issues in the hierarchy below a single, specific parent issue using portfolioChildIssuesOf("issue key")

https://support.atlassian.com/jira-software-cloud/docs/search-for-advanced-roadmaps-custom-fields-in-jql/

That works for only one parent issue at a time, and does not pull in any information about linked issues.

Jira does not natively support getting a list of linked issues that are linked to issues specified in another list. To do that with a single JQL statement would require a third party app.

nullvoxpopuli
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!
March 1, 2024

Jira does not natively support getting a list of linked issues that are linked to issues specified in another list. To do that with a single JQL statement would require a third party app.

 

Do you have any suggestions? <3

 

I'm trying to find the answer to the question:

How do you get a list of the full picture so that you can generate a "Dependency Report"?

I can re-structure the desired psuedo code search which hopefully adds some clarity:

X = KEY-###
epics = get all epics in X (parent issue type)

for each epic
issues = get all issues

for each of issues
recursively get all subtasks
recursively get all child issues
recursively get all linked issues

 and maybe in more code-based psudo code:

 # have to keep track of seen, so we don't recurse infinitely
let seen = new Set();

function getSubTasks(ofIssue):
let subTasks = howeverYouGetThese(ofIssue);
return children.map(getAllRelated);

function getChildren(ofIssue):
let children = portfolioChildIssuesOf(ofIssue); # the existing function
return children.map(getAllRelated)

function getAllLinked(ofIssue):
let links = getAllIssuesOfAnyLinkType(ofIssue);
return links.map(getAllRelated);

function _getAllRelatedHelper(ofIssue):
if (seen.has(ofIssue)) return [];

seen.add(ofIssue);

return [
...getSubTasks(ofIssue),
...getChildren(ofIssue),
...getAllLinked(ofIssue),
]

function getAllRelated(ofIssue):
return _getAllRelatedHelper(ofIssue).flat();

myList = getAllRelated("KEY-###");

 Now, I could use the API to do this, but then I don't have a dependency Report that I can share with folks, especially management, to provide a full picture of all blockers, etc.

If there were guardrails to force issue creation to be more flat, that may be helpful to prevent the need for recursive querying, but today there doesn't seem to be -- folks can add issue links as deeply as they desire, esp as linked issues kinda turn issues from being more "flat/tree"-like, to more of a directed graph (and in some cases bi-directional, if you're not careful with assigning link types)

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 1, 2024

You can satisfy this:

X = KEY-###
epics = get all epics in X (parent issue type)

for each epic
issues = get all issues

for each of issues
recursively get all subtasks
recursively get all child issues

with the portfolioChildIssuesOf("issue key") function.

I have a bit of confusion about this part:

for each epic
issues = get all issues

for each of issues
recursively get all subtasks
recursively get all child issues <<<<<

The native issue hierarchy of Jira is:

Epic > standard level issues (i.e. Story) > sub-task level issues

The hierarchy can be extended upward above Epic when you have a Premium subscription, but you can't change the hierarchy below Epic.

So I am confused by your statement about getting "all child issues" of issues that are children of Epics. The only "child" issues that a child of an Epic can have is sub-tasks. How are you creating child issues under children of Epics?

It might help if you provided screen images of your Issue Type Hierarchy, and screens to show the issues demonstrating an example of these relationships.

 

With regard to getting linked issues, one third party app that would allow you to do that is Adaptavist Enhanced Search

With that you could use their function "linkedIssuesOfRecursive()"

https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-functions#linkedissuesofrecursive

 

Do note that when you get the results of this query, it will not display in a hierarchical manner.

nullvoxpopuli
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!
March 1, 2024

> Do note that when you get the results of this query, it will not display in a hierarchical manner.

 

this is ok because the issue/ticket organization/linkage is not hierarchical, thanks! (it's a graph)

 

> https://docs.adaptavist.com/sr4jc/latest/features/scriptrunner-enhanced-search/jql-functions#linkedissuesofrecursive

 

this looks very nice!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events