I have a basic calculation on javascipt. It calculates true and changes the field's value with true value. But when I check it on database, it shows me ex-value of a field. I use
Xrm.Page.getAttribute("new_exchangerate").fireOnChange();
on formOnLoad. My actual code;
function ExchangeRateOnChange() {
var exchangeRate = Xrm.Page.getAttribute("new_exchangerate").getValue();
if (!exchangeRate) {
exchangeRate = 1;
}
var saleAmount = Xrm.Page.getAttribute("new_saleamount").getValue();
if (saleAmount) {
Xrm.Page.getAttribute("new_saleamounttl").setValue(saleAmount * exchangeRate);
// Xrm.Page.getAttribute("new_saleamounttl").setSubmitMode("always");
// I used setSubmit, but it won't worked too
}
}
In case you field is disabled on a form changes would not be sent to CRM Endpoints. To make it work try to add following after you've set value:
Xrm.Page.getAttribute("new_saleamounttl").setSubmitMode("always");
My first thought was: Xrm.Page.getAttribute("new_exchangerate").addOnChange(this.ExchangeRateOnChange);
Because calling Xrm.Page.getAttribute("new_exchangerate").fireOnChange();
doesn't call your method. But you said that it has calculate fields.
You can try to call Xrm.Page.getAttribute("new_saleamounttl").fireOnChange();
after you change field.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.