Fun with JScript and OnLoad

Microsoft CRM has always had the ability to use JScript on forms. In 1.x, you where limited to a subset of field types. In 3.0, all of the fields have the OnChange event (so if you change the value of the field, the script is triggered.) In addition, the actual CRM Form has two new events added for version 3.0. (OnLoad and OnSave)

Chris Regan wrote a very simple script that uses the OnLoad event to alert a user to the fact that the account they just opened up is on Credit Hold. To use this, open the forms designer. Then click on Form Properties.

Click on the OnLoad event type and click the Edit Button.

Click the Event Enabled box and type:

var oField = crmForm.all.creditonhold;

if (oField.DataValue)


 alert ("Alert! The Customer is on Credit Hold!")


Save all of the boxes and publish the changes.  So if you open the form, your user will be presented with the following.

This could get MUCH more complicated, but this gives you an idea of how you can help your customers using some of the new features in Microsoft CRM 3.0.  Enjoy!