How to debug jScript for Dynamics CRM?

自闭症网瘾萝莉.ら 提交于 2019-12-07 10:38:49

问题


Are there any tricks or tools for debugging those jScripts that you write in the web resources and attach to an event on a form ?
I have to customize a Dynamics CRM 2011 instance, which includes writing some jScripts.
The best I found until now is to click "I want to see the error that's being sent to Microsoft". Better than nothing, but I guess there must be something better ?
Thanks!


回答1:


If you use a decent version of IE (I hope you do), you could use the developer tools (F12). They also contain a JavaScript console/debugger which got really usable in the meantime.

You have to select the file which should be inspected, set a breakpoint and start debugging.

See this article for an example: http://www.furnemont.eu/2010/06/how-to-series-easily-debug-your-crm-javascript-code-in-ie8




回答2:


For development of form scripts use the Xrm.Page Script Library Template described in the SDK topic Write Code for Microsoft Dynamics CRM Forms. The CRM team blog post JScript IntelliSense for Form Script Libraries provides an overview.

When you use this template, in addition to providing form specific IntelliSense, you can debug your scripts in Visual studio without uploading them as Web resources. This makes initial development and debugging easier.

After you have it working, then create a JScript web resource and register it as a form event handler and test it in the application. At that point, use the technique described in the How-to series: Easily debug your CRM JavaScript code in IE8 (link in other answer) to debug your script using the IE developer tools.

The advantage of debugging your scripts outside of Microsoft CRM is simply that it is simpler. CRM loads many different scripts into the forms that it is sometimes tricky to isolate just your script.



来源:https://stackoverflow.com/questions/7329764/how-to-debug-jscript-for-dynamics-crm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!