Wednesday, December 28, 2011

Cancelling Onsave Event in MS CRM 2011 using java script

Some times we need to do some validations on javascript and that to be done on mostly onsave, so if the validation fails, we do not have to save the form.
In MS CRM 4.0 , it was different as follows
event.returnValue = false;
return false;

In MS CRM 2011, it will in different way as follows
1. need to pass the Context as follows onsave method of form
2. then use the context object inside Save function
function form_Save(executionObj){
executionObj.getEventArgs().preventDefault();}
thats it.

thanks,

yes.Sudhanshu

No comments:

Post a Comment