Is it possible to copy or access portfolio level data into lower level issue types

Jacob Francois January 31, 2025

I have two ideas to solve the problem, but I’m not sure which one is possible. 

 

I have a field name SME (user field) which is on the Portfolio level. My system is set up as follows: 

Portfolio -> Study -> Epic 

 

The goal is when I press the escalation button (transition) in the epic ticket, I want to grab the SME field from the Portfolio level ticket. I want to access the field via a post function. 

Another idea is what if I just add a Portfolio tab to my epic issue screen? The problem I’m running into there is how I can easily copy only certain field values from the Portfolio ticket into the epic ticket. I really would want it set up for all past tickets as well. 

1 answer

1 accepted

0 votes
Answer accepted
Kawan Diogo
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.
January 31, 2025

Hi @Jacob Francois 

 

I'm pretty sure it's possible get the value from the Portfolio in a Custom script post-function.

 

You can start building the logical with the template below:

 

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.fields.CustomField


def issue = issue

def getSMEValueFromPortfolio(issue) {

    def parentIssue = issue.getParentObject()

    while (parentIssue) {

        if (parentIssue.getIssueType().getName() == "Portfolio") {

            def customFieldManager = ComponentAccessor.getCustomFieldManager()

            def smeField = customFieldManager.getCustomFieldObjectByName("SME")

            return parentIssue.getCustomFieldValue(smeField)

        }
       parentIssue = parentIssue.getParentObject()

    }
    return null

}

def smeValue = getSMEValueFromPortfolio(issue)

if (smeValue) {

    def customFieldManager = ComponentAccessor.getCustomFieldManager()

    def smeField = customFieldManager.getCustomFieldObjectByName("SME")

    issue.setCustomFieldValue(smeField, smeValue)

}

return issue


This scripts makes the following steps:

  • Access the parent issue linked with the epic issue.
  • Verify if the issue are the Portfólio.
  • If it the Study, they look more one level.
  • Get the SME field value, and set in the original issue.

 

Have a try and let me know if needs any adjustment.

 

Best Regards

Suggest an answer

Log in or Sign up to answer