How to aggregate number/calculated number fields of all Issues within an Epic?

I've seen a number of different questions similar to this, but have had no luck in combining the various solutions into one that fits for me!

We have Issues within Epics (not storys), and capture costings/aggregated costings within the Issue. I'm trying to pull the aggregated costings for all Issues in an Epic, to give a total "cost" for the Epic. This is quite new to me so any help in triage would be greatly appreciated. The Epic is currently showing the field but not pulling the figures across the link.

This is what I've got:

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.component.ComponentAccessor;

def componentManager = ComponentManager.getInstance()
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()

customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_11078");

def totalSP = 0
issueLinkManager.getOutwardLinks( {issueLink ->
if ( == "Epic-Story Link") {
def linkedIssue = issueLink.destinationObject
def SP = linkedIssue.getCustomFieldValue(customField) ?: 0
totalSP += SP
return totalSP


Many thanks,


3 answers

Are you using server or cloud JIRA, which version? Where do you put this groovy script?

Cloud JIRA v6.3.11. Using Script Runner

There doesn't seem to be anything obviously wrong - I would put the script in the Script Runner console (not sure if it has it on cloud?) and try it with a given issue id - check what is returned for the custom field value of each linked issue.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 09, 2018 in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

391 views 6 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you