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--