Name
global.PlannedTaskRollupApi
Description
No description available
Script
var PlannedTaskRollupApi = Class.create();
PlannedTaskRollupApi.prototype = {
initialize: function() {
},
rollupActualEffort: function(current, previous) {
var rollupAPI = new RollupAPI();
if (current.operation() == "update" && current.parent.changes() ) {
if (previous != null && JSUtil.notNil(previous.getValue('parent')) ) {
gs.log("Rollup Previous Parent: " + previous.parent);
rollupAPI.rollup(previous, 'work_effort', false);
}
}
if(JSUtil.notNil(current.getValue('parent')))
rollupAPI.rollup(current, 'work_effort', false);
},
isValidRollUp: function(childTable, parentTable, field){
var excludedChilds = this.getRollupExclusions(parentTable, field);
if(new ArrayUtil().contains(excludedChilds, childTable))
return false;
return true;
},
getRollupExclusions: function(parentTable, field){
var gr = new GlideRecord("planned_task_rollup");
gr.addQuery('parent', parentTable);
gr.addQuery('field', field);
gr.addQuery('rollup', false);
gr.addQuery('navigator', 'parent');
gr.query();
var invalidRollups = [];
while(gr.next())
invalidRollups.push(gr.getValue('child'));
return invalidRollups;
},
type: 'PlannedTaskRollupApi'
};
Sys ID
1b786cbe9383220064f572edb67ffbf0