Form scripting allows a developer to perform a variety of actions within the Microsoft Dynamics CRM Online client application running in Microsoft Internet Explorer on the user's computer, including Microsoft Dynamics CRM Online for Outlook. When data is available in the client, performing actions there provides better peformance than using methods that require the user to save the record so that the actions are performed on the Web server.
Form scripting includes the following tasks:
Scripts are written using JScript and are associated with events on the Microsoft Dynamics CRM Online form or fields within the form.
There are two form events:
event.returnValue=false;
Each enabled field in Microsoft Dynamics CRM Online provides access to an onChange event. This event occurs whenever a user changes data in the field and the user clicks a different form element. Clicking another form element indicates that the user has finished making the changes in the field. Microsoft Dynamics CRM Online processes the onChange event first, and then the data in the field is validated again following the execution of the onChange event code.
Each event provides an Event Detail Properties dialog where scripts can be pasted and enabled. After the entity form is saved and published, the scripts become part of the metadata for the entity. This means that they can be exported and imported with other customizations.
Scripts can be tested using the Form Preview to confirm they work as expected before the form is published.
Always set dependancies on any form fields referenced in your scripts. The removal of a field that is referenced in a script will cause an error in the script. Setting the field as dependant will help prevent the accidential removal of a field that is being referenced in a script.
Scripts can perform a wide range of actions, such as:
When developing scripts that interact with Microsoft Dynamics CRM Online forms, be sure to only use supported objects, properties, and methods, which are documented in the Microsoft Dynamics CRM Online Client Programming Guide. Using supported objects, properties, and methods will help ensure that your form scripting customizations can be upgraded to the next version of Microsoft Dynamics CRM Online.