最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to debug jScript for Dynamics CRM? - Stack Overflow

programmeradmin2浏览0评论

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!

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!

Share Improve this question asked Sep 7, 2011 at 6:33 iDevlopiDevlop 25.3k12 gold badges96 silver badges158 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

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

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.

发布评论

评论列表(0)

  1. 暂无评论