I recently came across an interesting (and quite rare) error when trying to make some customizations in CRM. Any time that we made modifications to the account form’s OnLoad() event handler, we received the following message when trying to save the form:
When we viewed what the error report contained, we got the following:
<CrmScriptErrorReport>
<ReportVersion>1.0</ReportVersion>
<ScriptErrorDetails>
<Message>'firstChild' is null or not an object</Message>
<Line>795</Line>
<URL>/_static/tools/formeditor/scripts/util.js</URL>
<PageURL>/tools/formEditor/formEditor.aspx?formtype=main&objectTypeCode=1</PageURL>
<Function>PersistFormEventXml(oEventNode,oUpdatedEventObj)</Function>
<CallStack>
<Function>PersistFormEventXml(oEventNode,oUpdatedEventObj)</Function>
<Function>ViewFormProperties()</Function>
<Function>onclick()</Function>
</CallStack>
</ScriptErrorDetails>
<ClientInformation>
<BrowserUserAgent>Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; MS-RTC LM 8)</BrowserUserAgent>
<BrowserLanguage>en-us</BrowserLanguage>
<SystemLanguage>en-us</SystemLanguage>
<UserLanguage>en-us</UserLanguage>
<ScreenResolution>1680x1050</ScreenResolution>
<ClientName>Web</ClientName>
</ClientInformation>
<ServerInformation>
<OrgLanguage>1033</OrgLanguage>
<OrgCulture>1033</OrgCulture>
<UserLanguage>1033</UserLanguage>
<UserCulture>1033</UserCulture>
<OrgID>{A5B23DEB-8741-DD11-BD9C-001E0B5DA1CC}</OrgID>
<UserID>{D11670F8-8741-DD11-BD9C-001E0B5DA1CC}</UserID>
<CRMVersion>4.0.7333.1551</CRMVersion>
</ServerInformation>
</CrmScriptErrorReport>
The environment we saw this is was a multi-tenant environment and I had seen this error previously, several months ago and had fixed it in another organization, but I had absolutely no memory of how I did it.
It turns out, this error occurs when there is some invalid xml that lingers in the the account entity xml. The only known cases of this error have occurred in environments where the c360 products have been installed and then subsequently uninstalled.
Here’s what we did to fix it:
- Export the entity xml for the entity that this error occurs in.
- Create a backup copy of the xml file.
- Open the entity xml file for editing:
- Look for and delete the following xml from the file. It will be within the entity’s form xml:
<event name="onsave" application="false" active="true">
<script />
<dependencies />
</event> - Save the entity xml file.
- Import the corrected entity xml and publish.
What happens with the error is that the entity form has the event enabled, yet there is no actual code within the event. We have seen no way to have this error resolve itself using the CRM UI (the form editor).

Comments