A wierd thing happens in CRM 4 compared to CRM 2011. In CRM 2011 because it is a web resource, it’s that file which is loaded. This makes it easy to look at the list of scripts and then pick the one you want to debug.
but with CRM 4 it is different because it is a file called FormScript.js with lots of variables after it’s name. The other frustrating thing is it doesn’t have your onLoad script in it straight away, it adds it later on. This means you can’t put breakpoints on your code because it isn’t loaded yet.
In the end I did manage to put a breakpoint on the original FormScript.js and then one hit the breakpoint it had loaded my script and I could place some breakpoints in my code. The only problem is I’m not totally sure I could do it again.
Use the debugger statement in your code if you want to walk through code. You are able to leverage Visual Studio to analyze variable values as you execute your code. Very useful!
First, within Internet Explorer, uncheck “Disable script debugging (Internet Explorer)” and “Disable script debugger (Other)”
Next, add following code before any code you would like to debug.