Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,252
Community Members
 
Community Events
168
Community Groups

How to find all parents of query results?

Hello,

I am using the following JQL query to display in my project plan all issues:

key = ABC OR issueFunction in portfolioChildrenOf("key=ABC") OR issueFunction in issuesInEpics(" issueFunction in portfolioChildrenOf(\"key=ABC\")")

 

However some issues appear as unparented, since they belong to another hierarchal team, and so the parent is not displayed.

Is my query correct? How can I revise my query to present all parents of all issues? 

 

Many thanks for your expert advise.

2 answers

Hi @Yael Thion

welcome to the community!

Just taking a step back: Do I understand correctly that you want to query an issue ("key = ABC" in your JQL statement), and the entire hierarchy of issues "below" this issue?

And if that's the case, what do you want to do with this list of issues? Also, do you expect the issues to be shown in their hierarchy, or just as a flat list of issues?

hi @Hannes Obweger - Fine Software - JXL , thanks for your reply.

Indeed I am trying to present an issue with its entire hierarchy, but not only:

In fact I would like to present all issues assigned to a Hierarchal team, with their full hierarchy, but some of the issues are parented by issues in other Teams. so when I use the 2nd query below, many items remain unparented, because my query restricts the results to a specific team. I'm looking for a way to expand my query and allow me to display the entire hierarchy for each of the issues even if the parent is assigned to another team.

In terms of the way the issues are shown, normally when I use a search query the results are displayed as a flat list, but when I create a filter and base my project plan on it the view is shown as a tree view (not sure how this happens, I am quite new to Jira..)

Unfortunately I cannot seem to upload a screenshot, that would simplify my explanation..

Let me know if you have any ideas.

Thanks

 

Team in (123) OR issueFunction in subtasksOf("Team in (123)") OR (issueFunction in issuesInEpics("Team in (123)") OR issueFunction in subtasksOf("issueFunction in issuesInEpics(\"Team in (123)\") AND Team is EMPTY") OR issueFunction in portfolioChildrenOf("Team in (123)") OR issueFunction in issuesInEpics("issueFunction in portfolioChildrenOf(\"Team in (123)\") AND Team is EMPTY") OR issueFunction in subtasksOf("issueFunction in issuesInEpics(\"issueFunction in portfolioChildrenOf(\\\"Team in (123)\\\") AND Team is EMPTY\") AND Team is EMPTY ")) AND Team is EMPTY ORDER BY Rank ASC

I see. I kinda doubt that this is possible in "plain" JQL, as it really would require kind of a "join" operation (in database/SQL terms), which isn't supported in JQL. I'm happy to be proven wrong though, if anyone else has an idea.

For a completely different direction: There's a number of hierarchy-focused apps in the Atlassian Marketplace. These apps typically don't rely on plain JQL to establish parent/child relationships, but have their own ways of sorting this out. Depending on what you're planning to do with the resulting hierarchy of issues, one of these apps could be a good fit for you.

I can, of course, only speak for the app that my team is working on, JXL for Jira - but in JXL, this should be super-simple:

  • Pull in all issues that can, generally, be part of your hierarchy, e.g. all issues of a certain project.
  • Enable issue hierarchy. (If you want to use the Portfolio/Advanced Roadmaps hierarchy, you need to configure the additional levels just like you did for Portfolio/AR, but that's trivial to do.)
  • Filter for Team 123, and limit this filter to all top-level issues.

You should now get the exact hierarchy that you are looking for. You can operate on these issues directly in JXL, trigger various Jira operations on them, or export them for further processing.

This is how this looks in action:

filter-hierarchy.gif

(This is using a custom "Team" field, but it works with any field.) As I said before, there's a number of hierarchy-focused apps. You may already know that you can try any app for free for 1 months, so perhaps you want to explore a few and see which one works best for you.

If you have any questions on the above, just ping me anytime!

Hope this helps,

Hannes

Like Yael Thion likes this

hi @Hannes Obweger - Fine Software - JXL , 

This app seems like an interesting solution, but.. I'm using Jira at work and my organization has some limitations on which addons can be installed (including free ones), so I will have to ask the IT manager for special permissions in order to install JXL.

I'll try to reach out to him and find out if it's possible.

Thanks for the suggestion, I'll let you know if I managed to explore it.

Cheers

Yael

0 votes
Peter DeWitt Community Leader Aug 10, 2022

@Yael Thion , Welcome to the community!

It looks like you are using JQL functions from Scriptrunner. Try using this function:

issueFunction in epicsOf(Subquery)

 

cheers -dewitt

hi @Peter DeWitt , many thanks for your quick reply.

I tried your suggested solution and it didn't quite give me the results I was looking for.

I would like my project plan to display the hierarchy starting at Project level and ending with story.

here is the revised query I'm using:

issueFunction in epicsOf("key = ABC") OR issueFunction in portfolioChildrenOf("key=ABC") OR issueFunction in issuesInEpics(" issueFunction in portfolioChildrenOf(\"key=ABC\")")

But it is displaying the hierarchy starting at Function level.

I also tried this query based on Teams, as my issue is the fact that some of the parent functions/projects belong to another team:

Team in (123) OR issueFunction in subtasksOf("Team in (123)") OR (issueFunction in issuesInEpics("Team in (123)") OR issueFunction in subtasksOf("issueFunction in issuesInEpics(\"Team in (123)\") AND Team is EMPTY") OR issueFunction in portfolioChildrenOf("Team in (123)") OR issueFunction in issuesInEpics("issueFunction in portfolioChildrenOf(\"Team in (123)\") AND Team is EMPTY") OR issueFunction in subtasksOf("issueFunction in issuesInEpics(\"issueFunction in portfolioChildrenOf(\\\"Team in (123)\\\") AND Team is EMPTY\") AND Team is EMPTY ")) AND Team is EMPTY ORDER BY Rank ASC

This query gives me almost what I wanted - except for the parents which are in other teams.

(I'm trying to upload a screenshot to demonstrate but getting an error)

Let me know you thoughts..

 

Thanks

Peter DeWitt Community Leader Aug 11, 2022

I screen shot would be helpful - I'll also think about this one a bit and let you know what I come up with.

Like Yael Thion likes this

hi @Peter DeWitt , not sure why I can't upload a screenshot. I keep getting an error even using different formats. Let me know if there's another way for me to share with you the screenshot.

Thanks

Suggest an answer

Log in or Sign up to answer