SNOW-CAD Automating application logic with business rules and scripts • Set 3
SNOW-CAD Automating application logic with business rules and scripts Practice Test 3 — 15 questions with explanations. Free, no signup.
Refer to the exhibit. A Business Rule in the same scope calls this script include using 'var total = new MyUtils().getTotal("invoice", "state=paid");' but gets '0' even though there are records. What is the most likely cause?
var MyUtils = Class.create();
MyUtils.prototype = {
initialize: function() {},
getTotal: function(table, query) {
var ga = new GlideAggregate(table);
ga.addQuery(query);
ga.addAggregate('SUM', 'amount');
ga.query();
if (ga.next()) {
return ga.getAggregate('SUM', 'amount');
}
return 0;
},
type: 'MyUtils'
};