Pages

Thursday, July 28, 2011

CRM 2011: Error on page

While upgrading a CRM 4.0 environment to CRM 2011, I had to contend with the "Error on page" issue. That is, there was something in the jscript of the page that CRM was not liking which caused the page to render as with the "Error on page" message when loading and consequently with the "Microsoft Dynamics CRM has encountered an error" message when exiting the form.


I was further perplexed by the fact that this error did not appear to have anything to do with the form jscript as I disabled all onload and onchange events and yet the error did not go away. However after additional testing it did indeed appear to be linked to the jscript as when I cleared out the jscript of the form (as opposed to just disabling it) the error went away. Why the jscript should be affecting the form in such a way even when it is disabled is beyond me. It seems to defeat the purpose of being able to disable the jscript. But this is the first lesson from this exercise - jscript can affect form rendering even when it has been disabled. Maybe Microsoft will fix this in a future release.

Ok. So having determined that jscript was indeed the culprit the hunt was on to determine exactly which piece of jscript was throwing the form rendering off. This was a process of elimination whereby snippets of jscript would be removed until the offending jscript could be determined.

And what did it come to...?

I am sure this is not the only scenario which can result in this error but in my case it was because we had configured an on-click event for a field in the form. The 4.0 syntax of crmForm.all.field1.onclick = function() {} was troubling the application.

Once this had been removed the error went away... as did the cloud that was hanging over my head.

2 comments:

  1. Hi,

    Another way to get these pop-ups go away. Go to:

    File / Options / Privacy and click upon "Never send an error report to Microsoft about Microsoft Dynamics CRM".

    Regards,
    Sven

    ReplyDelete
  2. Thank you and yes I'm aware of that option. Just that I don't think it's a great option as by doing so you're ignoring the problem rather than addressing it and if it's a script error it's still going to cause form rendering issues. Lastly, this is a global setting (either at the server level or individual options level) and will ignore all errors rather than just specific ones and I'm not sure we want to ignore issues as that could give us a false sense of security. So all in all I personally think it's better to address than to ignore.

    ReplyDelete