Skip to content Skip to sidebar Skip to footer

Weird Error Typeerror: Cannot Read Property 'setvalue' Of Null At Onsuccessmapunitfields

This code was running fine until I decided to add 4 more lines of code, so I removed them. But I got this error, funny thing is I added my lines on the Form_onload function. I need

Solution 1:

Add debugger; inside Unit_OnChange function & the success callback function onSuccessMapUnitFields, then while debugging you can figure out that which one of the 3 fields among priceperunit, baseamount, ir_publishedrate is throwing this error.

Also verify if you are calling ActOnFields method to hide those 3 fields anywhere else before calling this setValue(price). Because if the control/attribute is not visible in the form - Xrm.Page.getAttribute returns null, then when you are trying to setValue it fails with this error.

Failsafe approach:

if(Xrm.Page.getAttribute("baseamount") != null){
       Xrm.Page.getAttribute("baseamount").setValue(price);
       Xrm.Page.getAttribute("baseamount").setSubmitMode("always");
}

Post a Comment for "Weird Error Typeerror: Cannot Read Property 'setvalue' Of Null At Onsuccessmapunitfields"