0
votes

I recently wrote some JavaScript that produced a null reference exception (only happens under certain circumstances). In our Dev environment the typical "out of the box" Javascript popup message that would alert me to issue didn't show up.

When we pushed the web resource to QA the "out of the box" JavaScript error message was displayed . I was wondering if there is a way that JavaScript error checking that produces these popups could have been turned off in our dev environment.

I am lost as to why the same code would show the out of the box error in one environment and not the other when the same reproduction steps were taken.

Javascript error displayed in QA but not Dev

2
Is it actually producing the same error? Have you tried debugging the Javascript in the Dev environment, and verifying that it actually produces the null error and should show the popup?Lars Kristensen
It depends on your browser settings. For IE check the internet settings dialog, tab Advanced.Henk van Boeijen
Please put a code for further investigationMunavvar Husein
Yes I have tried debugging in Dev and it should show the same error. I even went as far as trying to alert a variable that is not defined which would always throw an error and it threw the error in QA but not in Dev.Josh Jones
The issue with the Javascript itself has been fixed. That wasn't my issue I knew how to fix that right away. My issue is that I was never alerted to the script breaking in Dev since it seems like something is supressing the javascript error alerts.Josh Jones

2 Answers

0
votes

I can't see the image you've linked due to company firewall restrictions but I'm assuming it's the bult in error reporting dialog.

Your user record in the development environment may have error reporting turned off.

Within CRM:

  1. Settings
  2. Privacy Preferences
  3. Error Reporting
  4. Select the option "Ask the User for Permission..."

This will now show the prompt containing the stacktrace. You can also use the browser developer tools to view any console output.

0
votes

It is always better to check the existence of CRM fields in javascript before using the field. for eg.

if(Xrm.Page.getAttribute("FIELD_NAME") && Xrm.Page.getAttribute("FIELD_NAME").getValue()) 
{
// Perform operation on Xrm.Page.getAttribute("FIELD_NAME")
}