Tag: TypeError: Cannot read property ‘form_onload’ of undefined

Microsoft Dynamics CRM form on load error with or without javascript

Users Sometimes experience an error while opening a contact/any entity. Its an intermittent error and not reproducible all the time and for all users.

Error looks like this in Dynamics CRM UI :

1300.j1.png-600x600

 

When you download the error logs ; below is found:

TypeError: Cannot read property ‘form_onload’ of undefined

    at eval (eval at RunHandlerInternal (http://organization/form/ClientApiWrapper.aspx?ver=2115568044:153:1), <anonymous>:1:42)

    at RunHandlerInternal (http://organization/form/ClientApiWrapper.aspx?ver=2115568044:158:1)

    at RunHandlers (http://organization/form/ClientApiWrapper.aspx?ver=2115568044:117:1)

    at OnScriptTagLoaded (http://organization/form/ClientApiWrapper.aspx?ver=21

 

Resolution:

I created a solution, added the contact entity with forms and exported the solution. Opened the customization XML and found below.

The error has to do with InternalHandlers that is calling a library and a function form_onload  which is somehow attached to this event Hence I had commented out the below InternalHandler property.

 

<event name=”onload” application=”true” active=”true”>

<!–<InternalHandlers>

                    <Handler functionName=”Mscrm.ContactMainSystemLibraryWebResource.form_onload” libraryName=”Contact_main_system_library.js” handlerUniqueId=”4ea24ebd-795d-434e-af94-6812c3867b54″ enabled=”true” />

                  </InternalHandlers> –>

<Handlers>

<Handler functionName=”custom function” libraryName=”contact.js” handlerUniqueId=”{a2a97e43-583d-a4be-3dcb-2369a34a4193}” enabled=”true” parameters=”” passExecutionContext=”false” />

</Handlers>

</event>

 

Saved the customization.xml file and zipped the solution; imported back to CRM.

Hope this helps!

Cheers