Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How to get children of an issue all along the portfolio hierarchie with JQL and Script Runner?

Hi all together,

we're considering to buy ScriptRunner, and one of our considerations is whether it could help to simplify the stored filters for our portfolio plans.

We have some plans based filters that look like this:

issuekey in (MYPROJECT-6, MYPROJECT-8, MYPROJECT-10, ...)
OR issuekey in (childIssuesOf(MYPROJECT-6), childIssuesOf(MYPROJECT-8), childIssuesOf(MYPROJECT-10), ...)
ORDER BY key DESC, summary ASC, issuetype ASC

This works fine but it's annoying to maintain the filters.

Our portfolio hierarchy is: Thema - Epic - Story/Task/Bug - Sub-Task.

With ScriptRunner in our test environment I developed two new solutions.

The first solution uses five filters, depending hierarchically on the first filter:

MYPROJECT Unresolved themes:
project = MYPROJECT AND Type = Thema AND statusCategory != Done

MYPROJECT Epics of unresolved themes:
issueFunction in portfolioChildrenOf("filter = 'MYPROJECT Unresolved themes'")

MYPROJECT Grandchildren of unresolved themes:
issueFunction in issuesInEpics("filter = 'MYPROJECT Epics of unresolved themes'")

MYPROJECT Sub-Tasks to unresolved themes:
issueFunction in subtasksOf("filter = 'MYPROJECT Grandchildren of unresolved themes'")

MYPROJECT Unresolved themes and their family:
filter = "MYPROJECT Unresolved themes"
OR filter = "MYPROJECT Epics of unresolved themes"
OR filter = "MYPROJECT Grandchildren of unresolved themes"
OR filter = "MYPROJECT Sub-Tasks to unresolved themes"

The second solution uses only two filters, the second depending hierarchically on the first filter:

MYPROJECT Unresolved Themes and their family without Sub-Tasks:
(project = MYPROJECT AND Type = Thema AND statusCategory != Done)
(issueFunction in portfolioChildrenOf("project = MYPROJECT AND Type = Thema AND statusCategory != Done"))
(issueFunction in issuesInEpics("issueFunction in portfolioChildrenOf('project = MYPROJECT AND Type = Thema AND statusCategory != Done')"))

MYPROJECT Unresolved Themes and their whole family:
filter = ‘MYPROJECT Unresolved Themes and their family without Sub-Tasks' or issueFunction in subtasksOf("filter = ‘MYPROJECT Unresolved Themes and their family without Sub-Tasks'")

In this case, projects that don't want to see the Sub-Tasks in their plans can use the first one.

As you see, I have to use three different built-in functions of ScriptRunner to get the next lower hierarchical level.
Is there possibility to solve it simpler?

The portfolio built-in function childIssuesOf works over all hierarchal levels but can only be called with one issue key as parameter.

We're running Jira DC 9.4.8.

1 answer

Suggest an answer

Log in or Sign up to answer

To retrieve the children of an issue across the entire portfolio hierarchy using JQL and ScriptRunner in Jira, you can employ the 'issueFunction' provided by ScriptRunner. Use the following JQL query as a starting point: 'issueFunction' in linkedIssuesOfRecursive('issue = PARENT_ISSUE_KEY', 'is parent of'). Replace 'PARENT_ISSUE_KEY' with the key or ID of your parent issue. This query utilizes the 'linkedIssuesOfRecursive' function to fetch all issues linked recursively as children. Ensure ScriptRunner is installed, and you have the necessary permissions. Adapt the link type according to your portfolio hierarchy. Refer to the documentation for accurate details based on your Jira and ScriptRunner versions.

Hi Kaljan,

I've tried it out with one of our issues of type "Thema" (highest in the hierarchy) but only got the Epics belonging to it, but not the Stories and Sub-Tasks.

AUG Leaders

Atlassian Community Events