How to debug your JavaScript
The following include steps we should follow to prepare IE to debug JScripts in a CRM dynamics forms:Enabling the Every Visit to the Page Feature
- Start Internet Explorer.
- Select Tools, and then Internet Options.
- On the General tab in the Browsing history section, click Settings.
- Enable the Every time I visit the webpage option.
- Click OK.
Setting Script Debugging and
Friendly Errors Options
- Start Internet Explorer.
- On the Tools menu, click Internet Options.
- Click the Advanced tab.
- Clear the Disable script debugging (Internet Explorer) option.
- Clear the Show friendly HTTP error messages option.
- Click OK.
Debugging
Now simply add debugger;
Jscript command in your Jscript from event. Sample:
if (typeof (Account) == "undifined") {Account = {};} //*****************************// /* Main Account From Namespace */ //****************************// Account.DefaultForm = { CREATE_FORM_TYPE : 1, //*********** on Load **************// OnLoad: function() { debugger; Alert('OnLoad function of the Account Default form starts here'); }, //*********************************// };Publish your webresource and refresh the browser.
When you trigger the webresource (e.g. loading account form in the above sample code) the browser will show you a dialog box where you can debug your code in visual studio.
No comments:
Post a Comment