Dear Community
I have an Epic which has 2 stories. The story has a scripted numeric custom field named 'Delivery Estimate'. I want to get the sum of this field from stories to Epic. For this I have created a scripted field "Total Delivery Estimate", and I have written below code to fetch the values of Delivery Estimate at Epic level. The issue I see here is, jira script getcustomfieldvalue, does not fetch the value if custom field is 'scripted field'. Can anyone suggest if this is feasible and what would be the correct code.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.link.IssueLinkTypeManager
def customFieldManager = ComponentAccessor.getCustomFieldManager()
IssueLinkTypeManager issueLinkTypeManager = ComponentAccessor.getComponent(IssueLinkTypeManager)
IssueLinkManager issueLinkManager = ComponentAccessor.issueLinkManager
def value=0;
def linkType = issueLinkTypeManager.getIssueLinkTypes(false).find{ it.name == 'Epic-Story Link' }
def issueLinkList = issueLinkManager.getOutwardLinks(issue.id).findAll{ it.getLinkTypeId() == linkType.getId() }
for (issueLink in issueLinkList) {
def childIssue = issueLink.getDestinationObject()
def customField = customFieldManager.getCustomFieldObject('customfield_22601')
int currentValue= childIssue.getCustomFieldValue(customField)
if(currentValue){
value = value + currentValue
}
}
return value ;