Is there a way to use a Dictionary Entry Calculated value to total a related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2016 12:30 PM
I have a related list on a form that I need a currency column to total up to a field on the form. I want to use a Dictionary Entry Calculate Value to total so it totals instantly without an update to the record of the related list. Is this possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2016 12:33 PM
FYI, calculate will not change the value immediately - it needs you to save the record or update the record.
Its doesn't function like onChange script.
For your requirement, its better to go for onChange client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2016 12:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2016 12:57 PM
On seeing the design its better to go for before Business rule as there are two tables involved -
In this case, the before business rule should be on Work order cost table -
This BR should run on Insert, Update, and Delete also
I assume there is a relation to the work order cost table and to the parent task (Intercompany work order record), there should some reference - if I assume.
Write a before BR
Insert, Update, Delete checked
Any new activity happens in the work order cost table -
Script-
var amt = 0;
if (current.operation() == "insert" || current.operation() == "update")
amt = current.u_actual_cost;
if(current.operation() == "delete")
amt = -previous.u_actual_cost;
var grTask = new GlideRecord('task');
if(grTask.get(current.order_task)){ //this field should hold the task sys_id to which these work order cost refers
grTask.u_actual_cost = grTask.u_actual_cost + amt; //if the operation is delete, then it will subtract the previous cost, if it is update or insert, its just puts the value
grTask.update();
}
Hopefully it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-23-2016 01:02 PM
I actually have a BR right now but it will not update when the actual cost for that ledger changes because that ledgers actual cost is a Calculated Value from a total off the time card associated with the form. But when I change the time card that change does not apply to the form actual spend amount because I first have to go into the Ledge to update it before it will calculate it properly.