Wednesday, April 30, 2008

Stop the save event

Sometimes you need to stop a form from saving.

Case example - You are validating some data on the form and if the data is incorrect the save event must stop and retun back to the form rather than alerting the fault on the form and continuing saving the form. The OnSave event should return a "false" value to avoid the form from saving. This can be achieved by writting the following nugget.

event.returnValue = false;

To continue saving the CRM form you may want to use this

crmForm.Save();
or
crmForm.SaveAndClose();

Ronald Lemmen has given a few more nuggets. Also going through the SDK would give you an advantage. Plenty of them available.

Happy Scripting..|/