How to Create Re-usable JScript Libraries in Microsoft Dynamics CRM 2011

Although Microsoft Dynamics CRM 2011 offers several enhancements to allow for declarative customizations - no coding required - there are always going to be cases where customization is the only way to achieve certain behavior.

As Richard Knudson explains on his Dynamics CRM Trick Bag blog, re-usable libraries of JScript code in Microsoft Dynamics CRM 2011 are part of a brand-new construct known as a web resource. Knudson explains: "Think of web resources as virtual files: resources that can be stored in the CRM 2011 database that in CRM 4.0 would have required a physical disk file."

Whereas in CRM 4.0 the options for creating a reusable JScript function or utility each had limitations, CRM 2011 offers the ability to add JScript code to a library of web resources that can be accessed and executed from any form entity. Knudson walks users through a "Hello World" example and a more practical utility to update the format of phone numbers entered in forms. He adds:

Of course, the payoff is that you can now navigate to any entity and use the same function to provide formatting for any phone number field. After you finish off the account form, go to contacts, then leads, and so on.

Re-usable JScript Libraries in Dynamics CRM 2011