This.$E_2.contentWindow.document.body is null or not an object a script error when you enter data in a lookup field in Microsoft Dynamics CRM 2011

This article provides a solution to an error that occurs when you enter data in a lookup field in Microsoft Dynamics CRM 2011.

Applies to:   Microsoft Dynamics CRM 2011
Original KB number:   2671694

Symptoms

When you enter data in a lookup field that has the automatic resolution and most recently used items functionality enabled, you receive a script error when you tab off the field allowing automatic resolution to choose a most recently used value. When you expand the script error, you may see a detailed script error similar to the following example, referencing MRU fields or InnerHTML:

<CrmScriptErrorReport>

<ReportVersion>1.0</ReportVersion>

<ScriptErrorDetails>

<Message> 'this.$E_2.contentWindow.document.body' is null or not an object </Message>

<Line>6</Line>

<URL>/_common/global.ashx?ver=1810813519</URL>

<PageURL>/userdefined/edit.aspx?etc=2&pagemode=iframe&sitemappath=Workplace%7cCustomers%7cnav_search</PageURL>

<CrmScriptErrorReport>

<ReportVersion>1.0</ReportVersion>

<ScriptErrorDetails>

<Message> Unable to set value of the property 'innerHTML': object is null or undefined </Message>

<Line>6</Line>

<URL>/_common/global.ashx?ver=-1915844570</URL>

<PageURL>/userdefined/edit.aspx?

Cause

It occurs when tabbing off the field or saving the form before the most recently used values have finished populating

Resolution

The current workarounds are listed below:

Option 1:

Instead of entering characters in the field to use the most recently used values, select the lookup button to select the record in the Look Up Record window.

Option 2:

  1. In Microsoft Dynamics CRM, point to Settings, point to Customization, and then select Customize the System.
  2. Expand the entity in question, and then select Forms.
  3. Double-click the form so the form customization window opens.
  4. Find the lookup field causing the issue, and then double-click to open.
  5. Under Field Behavior, mark Turn off automatic resolution in the field and Disable most recently used items for this field.

Option 3:

Note

This option will send all script error reports to Microsoft automatically and will prevent any future Microsoft Dynamics CRM script errors from being displayed

For Individual users:

  1. In Microsoft Dynamics CRM, point to File, point to Options, and then select Privacy.
  2. Select Automatically send an error report to Microsoft without asking me for permission.
  3. It will stop the script error from occurring in this situation.

For Organization level:

  1. In Microsoft Dynamics CRM, select Settings, select Administration, and then select Privacy Settings.
  2. Select the Error Reporting tab.
  3. Click to mark the Specify the Web Application error notification preferences on behalf of users checkbox.
  4. Select Automatically send an error report to Microsoft without asking me for permission, and then select OK.

More information

<CallStack>

<Function>if(IsNull(this.$E_2)||IsNull(this.$E_2.parentNode))return;this.$E_2.contentWindow.document.body.innerHTML="";this.$E_2.parentNode.removeChild(this.$E_2);this.$E_2=null</Function>

<Function>(callback)</Function>

<Function>(callback)</Function>

<Function>function(){this.$D_0="";if(!IsNull(Mscrm.LookupMruListUI.$0_0)){Mscrm.LookupMruListUI.$0_0.clear();Mscrm.LookupMruListUI.$0_0.hide()}if(!IsNull(Mscrm.LookupMruListUI.$7_0)){Mscrm.LookupMruListUI.$7_0.clear();Mscrm.LookupMruListUI.$7_0.hide() }} </Function>

<Function>function(){this.$V_0()}</Function>

<Function>hideMruInternal()</Function>

</CallStack>

</ScriptErrorDetails>

<ClientInformation>

<BrowserUserAgent>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MS-RTC LM 8; AskTbORJ/5.13.1.18107; InfoPath.3)</BrowserUserAgent>

<BrowserLanguage>en-us</BrowserLanguage>

<SystemLanguage>en-us</SystemLanguage>

<UserLanguage>en-us</UserLanguage>

<ScreenResolution>1440x900</ScreenResolution>

<ClientName>Web</ClientName>

<ClientTime>2012-01-26T13:01:56</ClientTime>

</ClientInformation>

<ServerInformation>

<OrgLanguage>1033</OrgLanguage>

<OrgCulture>1033</OrgCulture>

<UserLanguage>1033</UserLanguage>

<UserCulture>1033</UserCulture>

<CRMVersion>5.0.9688.594</CRMVersion>

</ServerInformation>

</CrmScriptErrorReport>