I have a calculation field, I am using business rule to calculate the total onSave. I am using JavaScript onLoad to set the default field values to 1.00. The below code works fine onLoad, however onChange it doesn't set back the value back to 1.00. The only time the value need to be set to 1 is onLoad and if the user delete the value. For instance If a user put 10 for one of the field, onSave the total will be calculated. However if they decided to delete the value of the field I want it to be set to 1.00. The below code set it to null. Thanks!!
function onLoad() {
Test("new_field1");
}
function new_field1OnChange() {
Test("new_field1");
}
function Test(fieldName) {
if (Xrm.Page.getAttribute(fieldName).getValue() == null) {
Xrm.Page.getAttribute("new_field1").setValue("1.00");
}
else {
Xrm.Page.getAttribute("new_field1").setValue("");
}
}
*This post is locked for comments
I have the same question (0)


Report
All responses (
Answers (