Calculate rolling summation or subtraction between parent and child fields
<iframe width="560" height="315" src="https://www.youtube.com/embed/qMTL09QgiJo" frameborder="0" gesture="media" allowfullscreen></iframe>
This script retrieves values from the Expense field in the issue subtasks, and then subtracts them from the budget.
RollingFieldSummationParentChild.sil script
string [] stasks = subtasks(key);
int budget = customfield_10714;
if(isNotNull(budget)) {
for(string s in stasks) {
if(isNotNull(%s%.customfield_10713)) {
budget = budget - s.customfield_10713;
}
}
}
return budget;