Parent Link Queries In Portfolio

Mark O'Connor June 12, 2017

If anyone has some guidance on how to get dynamic Portfolio Queries I would appreciate it. Here is what I have:

• Issue “A” (a custom issue type) is at the top of my JIRA Portfolio hierarchy
• Issue “B” (custom issue type) has a Parent Link to issue “A” (it is second in my Portfolio hierarchy)
• Issue “C” (an Epic) has a Parent Link to Issue “B”
• Issue “C” has Stories, and those Stories have Sub-tasks.

I’m looking for a query that will return a list that includes:

  • A specific “A” issue and all parent links to “A” (the “B”’s). "A" is my issue of interest
  • “B” and all parent links to “B” (the Epics)
  • All Epics (the “C”’s), the Stories in each of those Epics and the Sub-tasks under each story.

I'd like this query to be the Portfolio Plan that I deal with, and further to be able to change my issue of interest dynamically (without having to change Porfolio data sources).

With great help from Johnny at Adaptivist and a minor addition, I’ve gotten the query results I'm looking for, but I'm struggling with how to setup a Portfolio Plan that allows me to change the issue of interest based on what I want to look at, without having to reconfigure issue sources in Portfolio all the time.

The query I ended up with involved creating a custom script field and then creating some filters around it. If you're interested here's how the query results problem was solved (thanks in large part to Johhny), here you go:

Grandparent Link custom script:

<import com.atlassian.jira.component.ComponentAccessor

if (issue.issueType.name == "Epic") {
def parentLink = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Parent Link")
def value = issue.getCustomFieldValue(parentLink)
def parentKey = value.key
def parent = ComponentAccessor.issueManager.getIssueByCurrentKey(parentKey)
def grandParent = parent.getCustomFieldValue(parentLink)
return grandParent.key
}
return null>

... and then running these filters;

filter 1: issue = [issue = PPM-38 OR "Parent Link" = PPM-38 OR "Grandparent Link" = PPM-38]

filter2: filter = 1 OR issueFunction in linkedIssuesOfAllRecursive('filter = 1')

Mark--

 

 

2 answers

1 accepted

0 votes
Answer accepted
Thomas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 13, 2017

Hi @Mark O'Connor,

 

If I understand correctly, your issue might be solved by the Scriptrunner `PortfolioChildrenOf` function detailed here: https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_portfolio

 

Hopefully that will be enough to match your requirements or help you move forward, let us know how it went!

 

Cheers,

Thomas

Mark O'Connor August 15, 2017

Thanks @Thomas. Yes indeed. I was actually working with the folks at ScriptRunner on this back in June. They incorporated this into a subsequent release, which we downloaded, and it works great.

This item is closed from my persepctive. Thanks for following up and thanks to the ScriptRunner folks for a real quick turnaround on this issue!

0 votes
Arun_Thundyill_Saseendran
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 7, 2018

Some examples. In this case, my interested issues are 'ISSUE1, ISSUE2...'

issueFunction in portfolioParentsOf('issueFunction in linkedIssuesOfAllRecursive("issue in (<ISSUE1>,<ISSUE2>,...)") and issuetype = Epic ') and issuetype = StakeHolder
issueFunction in portfolioParentsOf('issueFunction in linkedIssuesOfAllRecursive("issue in (<ISSUE1>,<ISSUE2>,...)") and issuetype = Epic ') and issuetype = Initiative

Suggest an answer

Log in or Sign up to answer