0
votes

I run on Windows 8 with IE10 (upgrading to 8.1 and IE11 later today) and I have random issues with my developer tools (F12) when developing for Microsoft Dynamics CRM 2011. From time to time, my code executes when I want it to, but I cannot debug it because the related javascript does not appear in the F12 developer tools. This happens randomly and without any obvious cause.

To be perfectly clear what the issue is: I have a Weekkalender_main_library.js file, which has been deployed from Visual Studio 2012 through the CRM Development toolkit. The javascript is added to Dynamics CRM 2011. It publishes without issues. I can add event handlers to a field just fine. The eventhandlers work, but there's a logical error in them. but when I press F12 and then open the scripts tab, the Javascript does not appear in the file dropdown. it shows all javascripts which are in CRM by default, and after some searching it seems like the javascript is in a dynamic block.

What causes this and how do I prevent it from occuring?

3
it's there, it's just in an anon block. When you use JS in the Ribbon or Events, this is how it gets loaded. You can add a debug statement to get into that block if you're having trouble.Mike_Matthews_II

3 Answers

0
votes

There are a couple issues that could be effecting you in this case. If the javascript is called from the ribbon, then it'll be loaded dynamically and you can't debug easily. (see this link for a great idea to be able to debug javascript from the ribbon * *Disclaimer ** This blog article was written by a colleague of mine*).

If you have multiple forms, you'll need to add the javascript resource to each form individually that you're calling it from.

This may also be similar to this question.

0
votes

I found out what the issue was.

Basically, Rollup 15 for Dynamics CRM 2011 changed the way scripts are loaded from separate files to dynamic script blocks. the change was made for improvements in the load and execution order of JS event handlers.

0
votes

For Chrome you can add the line //# sourceUrl="filename" to the JavaScript. It will then show up with the filename in the tree in the Sources in the Dev Tools.