Friday, February 27, 2009

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

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:

EntityEvent ModeValue
AllSave1
AllSave and Close2
AllSave and New59
Task, Phone Call, Letter, Fax, AppointmentSave as Completed58
AllDeactivate5
AllReactivate6
Alluser-owned entities Assign 47
E-MailSend7
LeadQualify 16
LeadDisqualify15

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;

No comments:

Post a Comment