Parent Link Queries In Portfolio

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 ( == "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')




1 answer

1 accepted

0 vote

Hi @Mark O'Connor,


If I understand correctly, your issue might be solved by the Scriptrunner `PortfolioChildrenOf` function detailed here:


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




Thanks @Thomas Barthelemy. 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!

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,264 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot