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

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

Gisela Lassahn October 23, 2023

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)
or
(issueFunction in portfolioChildrenOf("project = MYPROJECT AND Type = Thema AND statusCategory != Done"))
or
(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.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events