Creating a Sum of Custom Field Values

Peacock

Jira users often like to see the sum of time estimates (or other data) of child issues in the Epic.

Strategy

The idea here is pretty simple. Add up all the values of the child custom fields and display it in an Epic. We can do so in three ways:

Below are examples of each:

SIL Script Custom Field

This is preferred way to keep a sum of other custom fields. 

if (issueType == "Epic") {     string jql = "\"Epic Link\" = " + key;     string [] issues = selectIssues(jql);       interval totalEstimateForEpic;     for (string issue in issues) {         totalEstimateForEpic += issue.estimate;     }       return totalEstimateForEpic; }

SIL Listener

Use a SIL Listener. To set up a SIL Listener, see this documentation. Your script would look something like:

JFieldChange [] changes = lastIssueChanges(key);   if (changes[size(changes)-1].field == "estimate") {     string epic = #{Epic Link};     %epic%.estimate += #{Epic Link}; }

Live Fields

Use Live Fields as a listener. Your scrips would look something like the following. In the main script:

lfWatch("estimate", "estimate", "hook.sil");


The hook script:

Additional Help

Need help implementing this script? Talk to me directly to me by clicking on the bot on this page. 

Related articles

Filter by label

There are no items with the selected labels at this time.