Add event handlers for form events

Can I do this task?

You should have a thorough knowledge of JScript programming syntax and an understanding of the Xrm.Page object model before adding scripts, and should test your scripts before you publish customizations. Malformed scripts can prevent the form from working correctly.

More information: Form Scripting

  1. In the Navigation Pane, click Settings.
  2. Under Customization, click Customizations.
  3. In the Customization area, click Customize the System.
  4. Under Components, expand Entities, and then expand the entity you want.
  5. Click Forms. In the list, click a form to edit it if it has a Form Type of Main.
  6. On the Home tab, click Form Properties.
  7. On the Events tab, in the Event Handlers section, select onSave or OnLoad, and then click Edit.
  8. In the Handler Properties dialog box, supply the requested information. Select the Enabled check box to make the function available to be called by a field event.
  9. On the Non-Event Dependencies tab, in the Available fields list, select any fields you have referenced in scripts, and then click the Add Selected Records button Add Selected Records button to move the selected fields to the Dependent fields list.
  10. Click OK to close the Handler Properties dialog box.
  11. Click OK to close the Form Properties dialog box.
  12. Click Save and Close to close the form.
  13. When your customizations are complete, publish them:
    • To publish customizations for only the component that you are currently editing, on the Home tab, in the Save group, click Publish.
    • To publish customizations for all unpublished components at one time, click Publish All Customizations.

Related Topics

Create and Configure Entity Forms

Form Scripting

Understanding Entities

Test an event script

Did you find the information that you need?
Yes      No 
If not, what information do you need? (optional)