Microsoft Dynamics CRM Error: Unable to get property ‘form_onload’ of undefined or null reference

By - April 14, 2015

Recently, we were working with a client preparing to upgrade to Microsoft Dynamics CRM 2015 from Dynamics CRM 2013 Spring ’14 instance. Within their production environment, users complained of multiple issues: contact form becoming unresponsive in Google Chrome and Internet Explorer users complained of this dialog box whenever they opened a contact form:

JS Error 1

As a background, Microsoft Dynamics CRM is quite extensible and as such, you can trigger events in JavaScript through such actions as a tab or field changing state, or within the form loading or saving. In our case, the above dialog box tells us about an error in the onload event and a call failed on the form_onload trigger. The cause of this could be several things, but it tells us where to look, and to look for the missing reference, likely a JavaScript library. Judging that the message says “undefined or null references,” a good logical place to check would be the Web Resources portion of the form. Perhaps the JavaScript file was removed, a problem with the code has developed or someone deleted the function. To check this, go to then entity in question, then open a record, click the Ellipses > Form > Form Properties (on the navigation header) then view the Form Libraries and Event Handlers (Control > Form and Event > On-Load) to view the code. If the issue was with an errant library and faulty code, you could troubleshoot it here.

Unfortunately, analysis of the libraries available in the form provided no new insights (A simple Control +F of the available code and checks proved this) so it was off to the next step.

To troubleshoot, I opened up the form in Internet Explorer to recreate the problem since Google Chrome (versions 37 and 38+) doesn’t support modial dialogs and I was getting little to no feedback from the page at all. Once I saw the error above, a quick F12 > Tools > F12 developer tools allowed me to do some sleuthing. From here, a quick find command of the form_onload error showed me the event in question. I found a node with the InternalHandler and, based on the form_onload error, we were seeing the problem child. Judging from the “mscrm” nomenclature, somehow the Microsoft script is associated with the on_load event.

As a general note, we don’t want to necessarily remove the Microsoft reference since we don’t want to potentially cause more problems. We also don’t want to remove this only to find out through testing that this was not a fix. Therefore, best practices would be to export the solution and save a copy. Then, comment out the misaligned reference and import the solution into a development or sandbox environment to test the fix.

JS Error 2

To begin this process, we exported the entity and its forms from production and deployed this to a sandbox environment. Once we did this, we found that we had recreated the problem. From here, we imported a solution with the change described above. Indeed, after publishing these customizations, we found that this indeed was a fix. However, we were not done yet! As technology consultants for Dynamics CRM, it is so important to guide ourselves through a set of best practices including analysis, testing and confirmation of a proper fix. The nature of the error and the fact that the script in question is actually from Microsoft, it actually brings up a good use case for test environments and change management. Out of the box, Microsoft Dynamics CRM Online provides users with a Sandbox environment at no additional cost. As such, once we adequately confirmed a resolution, we could begin the methodical process of documenting our changes and resolution appropriately. In the order of client service, an effective change management and best practices strategy is key to any project.

The RSM teams are Certified Microsoft Dynamics professionals with a diverse skill set in software, hardware, customization, configuration, data management and data integration. Our professionals can help you extend your Dynamics CRM solution. Contact our professionals to learn more – by email at or by phone at 855.437.7202.

By: Charles Webb – Colorado Microsoft Dynamics CRM Partner

Receive Posts by Email

Subscribe and receive notifications of new posts by email.