List of Events available to trap in Scripts when saving a Dynamics CRM Form

By | February 27, 2009
CRM 3.0 has limited event detection made available using scripting. However It is now possible to detect which user action was performed to Save the form using the event.Mode property in the OnSave event.

You can gain more detailed information about the user actions in the OnSave event by referencing the event.Mode values. These values represent the buttons clicked by the user to save the record.

The following event modes are supported:


Entity Event Mode Value
All Save 1
All Save and Close 2
All Save and New 59
Task, Phone Call, Letter, Fax, Appointment Save as Completed 58
All Deactivate 5
All Reactivate 6
All user-owned entities Assign 47
E-Mail Send 7
Lead Qualify 16
Lead Disqualify 15
By checking the value of event.mode we can find out which button user has clicked and based on this take further action.

To cancel the Save operation event simply use the script below:
event.returnValue = false;