CRM 2011 – JScript Basics – Hello World

I have been looking at Form Scripting in CRM 2011 and it’s all change.

The first change you notice is they have added a new Web Resource area, which means that you can load a Jscript library which can be accessed by all the entities.

This means we can finally create reusable Jscript libraries.  It basically works by you uploading a Jscript file (you can also load other things like gifs, html, silverlight, icons, style sheet, css etc).   You can then access any of these Web Resources from any entity.  The reason you can do this is because rather than place these files somewhere on the CRM server, they get loaded into the database.  The other benefit of this is these files are the same for offline, in the cloud and over any servers (in a farm/load balancing way).

I have to mention at these point I didn’t find the CRM 2011 SDK very useful.

It mentions in detail the context object you can get lots of lovely entity variables from.

The Xrm.Page and it’s variable parts (collections, tabs etc)

but it didn’t have much of a Hello World example, which is slightly surprising because it is quite different in the basic setup.  Well maybe it did have a basic jscript example but I couldn’t find it.

I was going to write a basic example and then I found two brilliant blog postings so I thought I will just post a link to those.  I couldn’t write a better basic example so I’m not going to

Re-usable JScript Libraries in Dynamics CRM 2011

Form Scripting in CRM 2011

I ran through these and I liked the idea of ordering the various Jscript libraries in an entity, event framework.

2 thoughts on “CRM 2011 – JScript Basics – Hello World

  1. Elvis Herlan June 3, 2011 / 2:48 pm

    Hello! I’m a beginner and student in Dynamics CRM 2011 and I need a script in JavaScript that you type the number it returns me the zip code in the address fields, district, city, state, and country with information and fields city, state, and country are lookup view, choosing the information. Thanks for the help.


    • Hosk June 3, 2011 / 2:53 pm

      Basically you need to learn how to do this yourself.

      first start by going through the example in the SDK.

      start slowly by getting a variable and writing it out to a field on the form.

      get field

      set field
      Xrm.Page.getAttribute(“crimson_commissiontotal”).setValue(“NEW VALUE”);

      also typing in “the number” to return you all that information sounds pretty amazing, what number are you talking about. If you are looking for a postcode/ zip code lookup that is a fairly complex piece of code which people sell, if I did have it I’m not sure I would just give it away for free.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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