Hey Guys,
I want to auto populate the Actual Revenue Field in Opportunity Close form, from another field (ie. Estimated Revenue) when the Actual Revenue is NULL or =0.
I've tried wrote the Jscript below, It seems to be updating the Actual Revenue Field correctly but after it saves value is NULL. I believe it's overwriting my value with the opportunity close form's Actual Revenue Value. Please HELP and happy holidays.
=============================================================================================
if (event.Mode == 5) {
// If status is won
if (status == 1) {
var ActualRevenue = Xrm.Page.data.entity.attributes.get("actualvalue");
var ActualRevenueValue = ActualRevenue.getValue();
var TotalForecastRev = Xrm.Page.getAttribute('onx_totalforecastrevenue').getValue();
if (ActualRevenueValue == null) {
ActualRevenue.setValue(TotalForecastRev);
}
}
}
=============================================================================================