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.
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:
Have a try and let me know if needs any adjustment.
Best Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.