- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017 02:48 PM
Here my script:
but not working it..
Business rule: table :incident
var totalA = 0;
totalA += current.u_used_amount;
var bRec = new GlideRecord('u-details');
bRec.query();
if(bRec.next()){
bRec.u_reaming_balance = totalA;
bRec.update();
}
8000+5000+3000=16000 , display result sum in u_details table
Table: u_details
Field: u_remaing_balance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017 03:34 PM
Hi Srivastav,
(function executeRule(current, previous /*null when async*/) {
var cal = 0;
var gr = new GlideRecord('incident');
gr.addQuery('category', 'software'); // is it mandatory ??
gr.query();
while(gr.next())
cal = parseInt(cal) + parseInt(gr.u_used_amount);
var bRec = new GlideRecord('u_details');
bRec.addQuery('fieldname', 'pass the filter value here'); //if it is new table of field then the field is empty , WHAT DO NOW
bRec.query();,
if(bRec.next()){
bRec.u_reaming_balance = cal;
bRec.update();
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2017 10:47 AM
If you want that value displayed on the list, use Configure > List Calculations to add a sum value to the bottom of that column.
It won't provide a running total of all values, but just those being displayed.
As a matter of interest, what will this value be used for? If you're doing reports, PA contains functionality to see historical data.