简体   繁体   English

如何调试Dynamics CRM的jScript?

[英]How to debug jScript for Dynamics CRM?

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 ? 是否有任何技巧或工具用于调试您在Web资源中编写并附加到表单上的事件的jScripts?
I have to customize a Dynamics CRM 2011 instance, which includes writing some jScripts. 我必须自定义Dynamics CRM 2011实例,其中包括编写一些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! 谢谢!

If you use a decent version of IE (I hope you do), you could use the developer tools (F12). 如果你使用一个不错的IE版本(我希望你这样做),你可以使用开发人员工具(F12)。 They also contain a JavaScript console/debugger which got really usable in the meantime. 它们还包含一个JavaScript控制台/调试器,在此期间可以使用它。

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 请参阅此文章以获取示例: 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 . 对于表单脚本的开发,请使用SDK主题“为Microsoft Dynamics CRM表单编写代码”中描述的Xrm.Page脚本库模板。 The CRM team blog post JScript IntelliSense for Form Script Libraries provides an overview. CRM团队博客文章JScript IntelliSense for Form Script Libraries提供了概述。

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. 使用此模板时,除了提供特定于表单的IntelliSense之外,还可以在Visual Studio中调试脚本,而无需将其作为Web资源上载。 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. 使它工作后,创建一个JScript Web资源并将其注册为表单事件处理程序并在应用程序中对其进行测试。 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. 此时,使用操作系列中描述的技术:在IE8中轻松调试CRM JavaScript代码(在其他答案中链接)以使用IE开发人员工具调试脚本。

The advantage of debugging your scripts outside of Microsoft CRM is simply that it is simpler. 在Microsoft CRM之外调试脚本的优点就在于它更简单。 CRM loads many different scripts into the forms that it is sometimes tricky to isolate just your script. CRM将许多不同的脚本加载到表单中,有时候很难区分脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM