I have added two new fields to the Account entity: triggerfield and calculatedfield. the triggerfield taks in a number multiplies it by 3.14 and stores it into the calculatedfield, at least it should. but for some reason it throws an unknow error.
I have added the js file to crm libraries and the attributes names match between CRM and my js file. Can someone please tell me what i am doing wrong?
here is the code:
function UpdateField(){
var trig = Xrm.Page.getAttribute("new_triggerfield");
var dest = Xrm.Page.getAttribute("new_calculatedfield");
// Test to make sure the trigger field has a value, this will return null if blank.
if(trig.getValue() != null){
var newValue = trig.getValue() * 3.14;
Xrm.Page.getAttribute("new_calculatedfield").setSubmitMode("always");
dest.setValue(newValue);
}
}