Reputation: 2306
Just wondering if there is anyway to have intellisense support whilst working on javascript files in Dynamics CRM 2011? I know that you can have this support if you use Visual Studio, however just wondering if there is any way we can do it within CRM app itself.
Any suggestions on this would be great!
Upvotes: 5
Views: 4338
Reputation: 161
Sorry should have read more carefully before posting. But if you are using VS...
See http://blogs.msdn.com/b/crm/archive/2011/04/07/jscript-intellisense-for-form-script-libraries.aspx. I'm the writer for this part of the CRM SDK. I made this solution and included it in the SDK. It provides for JavaScript IntelliSense based on the structure and data found in a specific form. There is a Visual Studio extension and a supporting CRM managed solution.
This CRM SDK Topic introduces the solution: http://msdn.microsoft.com/en-us/library/gg328261.aspx.
This solution is a bit different from the other IntelliSense solutions because it actually implements most of the Xrm.Page functions so you get IntelliSense AND some capability to test your code against a snapshot of an individual form that contains data. You don't have to upload your files as web resources. You can do a sanity check first and avoid major debugging of the web resources from inside CRM.
What it does not do is provide the names of the individual form attributes you might want to reference (although the snapshot of the page data provides this in in an easy to read JSON format). It focuses on the syntax for the API and the available methods. If you type Xrm.Page.getAttribute('new_optionset'). you will only see the methods that are valid for an optionset attribute. While all attributes have getValue and setValue functions, not every attribute has a getOptions method. It does not require that any additional library be added to your script in order for them to work.
I think the other intellisense libraries are great. Thanks to those folks who made them. The solution I made has a bit more overhead but you get a different experience too. Use whichever one works for you.
Upvotes: 6
Reputation: 1467
Have a look at the Shrpr web resource editor which has syntax highlighting, brace matching and some simple code completion (not full intellisense, but still worth it).
http://www.shrpr.org/2011/11/shrpr-web-resource-editor-first-release.html
(there are later releases too, but the first announcement had most information in)
Upvotes: 0
Reputation: 550
You need to add file XrmPage-vsdoc.js to your project in VS2010 and then add a reference to it like this
///<reference path="..\IntelliSense\XrmPage-vsdoc.js"/>
to the top of your *.js file and you'll get working IntelliSense. For more information look at this post CRM 2011: IntelliSense for Xrm.Page
Upvotes: 2
Reputation: 966
Since the script editor inside CRM is just a plain text box, I think the answer is no, and believe me I'm sorry to say that! You would think they'd at least have set the font to a true-type like courier to help a little bit with editing.
I find the easiest way is to use a lightweight text editor with syntax highlighting, like Notepad++. It's free, of course ;)
If you copy the code out of CRM's editor, paste it into Notepad++ and select JavaScript as the language, it'll give you the same syntax highlighting as Visual Studio but without associated load times (don't get me wrong, I love Visual Studio but it's massively overkill for a small JavaScript change). Also it'll let you set indentations properly. Then when you're done editing, copy and paste back into CRM.
I find this especially useful if I need to make a quick change on a machine where Visual Studio isn't available.
Upvotes: 4