I am trying to get a field to do a simple calculation and put the result in another field. Here is what I have
Field 1 = Estimated Project Amount (estimated amount of a project)
Field 2= Fee % (Fee percentage we'll apply to that)
Field 3 = Construction Fee (the result - for instance 15% on a $1,000,000 project would result in 150,000)
In the Fee% field i have the following event in the Fee% field - On Change
function calculate()
{
var val1 = Xrm.Page.entity.attributes.get('new_estimatedprojectamt").getValue();
var val2 = Xrm.Page.entity.attributes.get("new_fee").getValue();
if (val1 == null) return;
if (val2 == null) return;
var result = val1 * val2;
Xrm.Page.entity.attributes.get("new_constructionfees").setValue(result);
}
When i try to enter a number into the field i get the following error
There was a error with thie field's customized event
Field: new_fee
Event:onchange
Error:'calculate' is undefined