Portfolio
These functions are only available if Portfolio for Jira is installed.
After first install the version of ScriptRunner containing these functions, a full reindex is required, otherwise they will only show results for issues updated from that point.
portfolioChildrenOf
portfolioChildrenOf(Subquery)
Find issues that are children of the specified subquery.
For example, given the following Portfolio hierarchy:
Theme
Initiative
Epic
Story
To find all Initiatives that belong to Themes in a certain status:
issueFunction in portfolioChildrenOf("status = 'To Do'") and issuetype = Initiative
To find all children of Themes:
issueFunction in portfolioChildrenOf("status = 'To Do'")
This function does not traverse the link from Epic to Story. To also find stories you could combine multiple functions. First of all, create and save a query that finds all children of the Themes or Initiatives, e.g. save the above function as Children of initiatives.
Then the following function will also the stories of the epics:
filter = "Children of initiatives" or issueFunction in issuesInEpics('filter = "Children of initiatives"')
It can be useful to find high-level items that have not been properly placed in a structure. To search for Initiatives with no Themes:
issueFunction not in portfolioChildrenOf("issuetype = Theme") and issuetype = Initiative
portfolioParentsOf
portfolioParentsOf(Subquery)
The converse of portfolioChildrenOf
. Finds parent issues of the provided subquery.
To find all themes of unresolved Epics you might use:
issueFunction in portfolioParentsOf("issuetype = Epic and resolution is empty") and issuetype = Theme
Continuing the example from above where we are looking for issues that did not fit the hierarchy, we can search for any Themes that have no children. Notice the not in.
issueFunction not in portfolioParentsOf("issuetype = Initiative") and issuetype = Theme
In simple terms, this looks for all Themes that are not the parent of an Initiative.
If you want to start from Stories, you need to create a combination of queries. Let’s search for open Initiatives of closed Stories:
issueFunction in portfolioParentsOf('issueFunction in epicsOf("issuetype = Story and status = Done")')
and issuetype = Initiative and resolution is empty