I've got a script which runs on page load and does the following.
===== start of js file======
var curFldCtrl = Xrm.Page.getControl("transactioncurrencyid");
function ResetFieldLayout() {
curFldCtrl.setVisible(false);
}
function OnLoad() {
ResetFieldLayout();
}
===========end js file==============
Funny thing is that this code works find in Chrome and IE11, but when I run it in Microsoft Edge, it throws an error.
There was an error with this field's customized event.
Field:window
Event:onload
Error:Unable to get property 'setVisible' of undefined or null reference.
Anyone come across this before or know why this is happening?
Thanks in advance.
Try placing the variable declaration inside your function.
function ResetFieldLayout() {
var curFldCtrl = Xrm.Page.getControl("transactioncurrencyid");
curFldCtrl.setVisible(false);
}
function OnLoad() {
ResetFieldLayout();
}