Form scripting customizations

Part 10 of "11 things to know about customization"

Published: April 20, 2007

Whenever possible, customizations should be implemented to occur on the user’s computer. These customizations are fastest because they do not require a round trip to the server before they are applied. Form scripting is the way to achieve this in Microsoft CRM.

*
**
**
On This Page
EventsEvents
Adding ScriptsAdding Scripts
Form Object ModelForm Object Model

Events

Microsoft CRM supports two events on every Microsoft CRM entity form: OnLoad and OnSave. The OnChange event is available on every field in the form. This means that you can include logic within the form when it loads, when the user saves, or when the value of a field changes.

Adding Scripts

You paste your scripts into the definition of the entity forms. Scripts then become part of the entity metadata, and can be exported and imported to another system alongside all the other customizations.

The scripting language is Jscript, which is functionally equivalent to JavaScript and is well known by many Web developers. For each event, a developer can interact with an object model in the form. This object model is documented in the Microsoft Dynamics CRM 3.0 Client Programming Guide, which describes how a developer can access different properties and methods on the forms.

Form Object Model

Microsoft CRM supports using the objects and methods that are provided by Microsoft CRM. But, because Microsoft CRM uses Internet Explorer to show the pages, developers can do almost anything that they usually do in a Web application. They can call a Web service or work with another application displayed in an IFrame.

The important thing to avoid in form scripting is referencing any elements of the HTML pages that are not documented in the Client Programming Guide. The only supported items in the pages that can be programmatically referenced or manipulated are documented in this guide. You might not be able to upgrade your customizations if you reference unsupported elements or functions because they might not exist in the next version. For more information about things to avoid in form scripting, see Unsupported scripting in the Microsoft Dynamics CRM Team Blog.



Was this information useful?