I'm trying to get the total number of Story Points from Linked Issues (is Feature of) onto a custom scripted field on a Feature. Here's the code:
import com.atlassian.jira.component.ComponentAccessor;
enableCache = {-> false}
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def totalSP = 0.0
log.debug("${customField.id}")
log.debug("Issue ${issue}")
issueLinkManager.getIssueLinks(issue.id)?.each {issueLink ->
if (issueLink.issueLinkType.name == 'is Feature of') {
customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Story Points")
def SP = issueLink.destinationObject.getCustomFieldValue(customField) as Double ?: 0.0
log.debug("SP value ${SP}")
totalSP += SP
}}
return totalSP as Double
This worked for getting the total Story Points from Epic Links, but doesn't work currently.
Please help!
Thanks,
Matt