Dynamics CRM – Window OnLoad Unable to get property ‘value’ of undefined or null reference

We recently had a problem where we were receiving the following error in a single environment only.

Error

Due to it only occurring in one environment I presumed it was a deployment issue. However I was incorrect.

We were receiving the above error because we restored a full database from one environment to another. We had some JavaScript which was checking the owner of a record. The owner was displayed on the record however it was from an external domain.

Because of this it threw an error right down in the CRM depths at:-

function crmForm_window_onload_handler(eventObj,eventArgs){

  try{

    var eContext=Mscrm.FormUtility.constructExecutionObject(eventObj,0,null,null);

    eContext=Mscrm.FormUtility.constructExecutionObject(eventObj,0,null,eContext)

    loadInsideView();

    eContext=Mscrm.FormUtility.constructExecutionObject(eventObj,1,null,eContext)

    CEI.Initialize();

  } catch(e) {

    displayError('window', 'onload', e.description);

  }
}

So if you see an error occurring like this that did not appear in other environments make sure you confirm that the record you are looking at is correctly mapped to the new domain.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s