Client Side Scripting

banner art

The Microsoft CRM 3.0 Web application includes improved support for scripting. In addition to scripting for OnChange events, you can also add scripts to fire for OnLoad and OnSave events. These events can be fired off of all types of fields. Additionally, you can address a specific field on the form, and then set and read its value. Picklists can be constructed dynamically.

You can configure events in the form editor in the Web application and in the configuration files for the application and the Microsoft CRM 3.0 client for Microsoft Office Outlook. They are also importable and exportable using Import Customizations and Export Customizations tools or APIs.

Scripting Language

JScript is the supported language for scripting Microsoft CRM Forms. JScript is the Microsoft implementation of the ECMA 262 language specification (ECMAScript Edition 3). With only a few minor exceptions (to maintain backwards compatibility), JScript is a full implementation of the ECMA standard. For more information on JScript, see

Note   Syntax differences between Microsoft Dynamics CRM version 1.2 and version 3.0 in may cause client-side script failures after upgrade. The following is a list of syntax changes:

  • The syntax crmForm.all.(fieldname) is now required when making a call to field level methods and properties.
  • The value property has been replaced with the property DataValue.
  • The DateTime field in accepts only a Date object as a valid parameter.


// The following sample shows how to assign a date value in Microsoft CRM 1.2.

crmForm.effectiveto.value=FormatDate(ParseDate("September 25, 2005"));

// The following sample shows how to write the same code in Microsoft CRM 3.0.

var dateString = new Date (2005, 9, 25);
crmForm.all.effectiveto.DataValue= dateString;;

Another improvement in scripting is that when you edit scripts, all formatting is retained to improve readability and maintainability.

Note   Use of /* … */ style comments is preferred in scripts.

In This Topic


Describes how to use the form and field events.

Form Object Model

Provides details of the object model for Microsoft CRM forms.

Accessing Web Services

Explains how to access the Microsoft CRM Web services from your custom scripts.

© 2007 Microsoft Corporation. All rights reserved.