How can we help?

Michael Ochs

Problem:

Since upgrading to CRM 2013 we’ve been getting an annoying popup message on load of the contact form:

There was an error with this field’s customized event.
Field:window
Event:onload
Error:Unable to get property ‘form_onload’ of undefined or null reference

form_onload

This was happening in CRM instances to which we’d imported our managed solution, but not in the unmanaged environment. Apart from being annoying, the error was preventing our custom OnLoad javascript from running. What we discovered is CRM is incorrectly marking the system javascript files as removed from the managed solution.

As of writing this I’ve yet to find anything we’ve done to cause this issue and it appears to not be unique to our customizations as you can see here. It would appear to be a bug in CRM, however, we have found a workaround for it until it’s fixed.


Workaround:

1. Export your managed solution including all required components.
2. Open the managed solution zip package and copy out the customizations.xml file to a location on your computer.
3. Open the customizations.xml file in the editor of your choice and find the following line.

<internaljscriptfile src=”$webresource:Contact_main_system_library.js” solutionaction=”Removed” />

4. Remove the text that reads solutionaction=”Removed”
5. Save the customizations.xml and copy it back into the solution zip overwriting the existing file.
6. Import your managed solution to the CRM instance where the error was ocurring.
7. Once the import is complete. Verify the error is gone. Also, you can verify the fix using developer tools from a contact record by ensuring the Contact_main_system_library.js library is being included on the form.

Before

Cams_without_JS

After

Core_with_JS


CONCLUSION:

What’s interesting is it appears that all of the system entity js files are being marked as “removed” in the managed solution. This is almost certainly a bug in CRM. I don’t know of anyway that you could inadvertently remove a system js library. However, none of the other forms seem to exhibit the same behavior as the contact form. In our solution I removed the offending attribute from the xml for all of these. The only drawback to this solution is we will have to remember to perform these steps everytime we export our managed solution. The good news it will fix the issue even if we forget the first time and the error is prominently located on the contact form so we should be able to quickly identify if we forgot to apply the fix. Hopefully, this will get fixed in a future release.

 


Request a demo

Keep updated with our news & articles.