I'm trying to learn JS and create a simple JS function to add up 8 fields and put the total into a variable TT and update a field Total Time with that variable.
I have it set for onsave on the form but the field is not updating. These are all whole number/duration fields. Is there some problem with my JS?
function Form_OnSave() {
// All all of the duration fields in the form
var tt =
(Xrm.Page.getAttribute("new_billabletime").getValue() +
Xrm.Page.getAttribute("new_billabletraveltime").getValue() +
Xrm.Page.getAttribute("new_mfgrwarrantytime").getValue() +
Xrm.Page.getAttribute("new_lunchandbreaks").getValue() +
Xrm.Page.getAttribute("new_warrantytime").getValue() +
Xrm.Page.getAttribute("new_ojttime").getValue() +
Xrm.Page.getAttribute("new_billabletimeot").getValue() +
Xrm.Page.getAttribute("new_billabletraveltimeot").getValue());
Xrm.Page.getAttribute("new_totaltimeaccountedfor").setValue(tt);
}
Thank you
*This post is locked for comments