Dynamics CRM 2011 - Preventing close alert
In Dynamics CRM 4.0 it was easy to disable close alert by using this one line of code before you close the window:
crmForm.detachCloseAlert();
In Dynamics CRM 2011, this method is depracated. The way i workaround it, is setting all dirty fields submit mode to never.
function IsAttributeDirty(attribute, index) { return attribute.getIsDirty();}Close window with out fields change message:
function SetAllDirtyFieldsToNeverSubmit(){ var attributes = Xrm.Page.data.entity.attributes.get(IsAttributeDirty); for (var i in attributes) { attributes[i].setSubmitMode("never"); }}//ends function RemoveAllDirtyFields(){
SetAllDirtyFieldsToNeverSubmit();
Xrm.Page.ui.close();
Neat!
ReplyDelete/Jonas
http://jonasrapp.cinteros.se/