CRM 2011 – Tool – JavaScript Model Generator

I like to see what useful tools are being created  and there have been some fantastic ones, my favourite is the sitemapeditor

I have been writing some Javascript recently and it’s always a bit of a hassle having to look up all of the  names of the fields you want to use.

In CRM 4 there use to be an excellent tool which created some intellisense for you but I haven’t found anything which is really useful for CRM 2011.

so it is with some interest I saw a tweet from CRM MVP Donna Edwards about a Javascript model generator.  The project is available on codeplex and you can download it using the link below

http://crmjsmodelgenerator.codeplex.com/

Now it took me a while to work out how to get this working, these are the instructions

How to generate it:

NOTE – Make sure your javascript file changes are saved before generating the model as your unsaved changes will get overwritten.

  1. Edit the provided sample.jsconfig file.
  2. Update CrmServer to use the correct server and org.
  3. Set the JsDirectory to be the folder where your script files are located.
  4. Add an Entity node for the entity form that you will be working on
    • EntityName is required and needs to be the schema name
    • FileName is optional and it will try to use the EntityName + “.js” to find the javascript file in the JsDirectory. Use this if the file name is different than the EntityName
  5. Run the JSModelGenerator.exe

<JsConfig CrmServer=”http://server/org&#8221;
JsDirectory=”C:\Source\Project\Scripts”>
<Entities>
<Entity EntityName=”contact” FileName=”contact.js” />
</Entities>
</JsConfig>

I changed the config file but then I was running it and nothing was really happening.  What you have to do is copy specify where the downloaded javascript files are on your computer and then it will update those files and add in the intellisense code to the file.

I quite like this solution because I can now quickly find all the fields on a form and it’s quick and easy to run

 

 

 


3 thoughts on “CRM 2011 – Tool – JavaScript Model Generator

  1. Blake Scarlavai March 8, 2012 / 7:05 pm

    Thanks for the post! Glad you like it. The best part is that it caches the form objects behind the scenes when you access them 🙂

    Like

  2. Jonathan March 8, 2012 / 11:09 pm

    Form.Attributes dosen’t work for me on vs 2011 for some reason.
    Form.Sections works.

    Like

    • Jonathan March 9, 2012 / 12:51 am

      after I turn off the resharper interllisanse, it all works.

      Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.