Tuesday, 2 August 2016

CRM 2015 - 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.


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.

Tuesday, 31 May 2016

CRM 2015 - Filtered View using a Lookup in the Criteria

Consider you want to use a lookup as part of your filter criteria.  You would presumably use "Where lookup Equals mylookup" however when doing this the following fetch XML is returned.



When exporting to another environment it appears that it is looking at the GUID and not the name.  The short term fix I'm using is to instead use Contains.