Hi,
I found in other questions here, an answer which partially cover my question (https://answers.atlassian.com/questions/165598), but I want to have this to work only for linked issues with "Epic link", so I made some modification in code:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor;
def componentManager = ComponentManager.getInstance()
def issueLinkManager = componentManager.getIssueLinkManager()
def cfManager = ComponentManager.getInstance().getCustomFieldManager()
double totalSP = 0
customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Story Points");
log.debug("${customField.id}")
issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->
if (issueLink.issueLinkType.name == "Epic-Story Link") {
def SP = issueLink.destinationObject.getCustomFieldValue(customField) ?: 0
totalSP += SP
}}
return totalSPBut it does not seem to work - when changing Story Points of some issues liked with epic link this scripted custom field displays random values (when refreshing page this value changes).
Do you have any clue where I made a mistake? (nothing found in logs)
(JIRA version 6.4.12, Service Runner - 3.1.4, scripted field use: Number Searcher and Number Field Template)
Thanks,
Paulina