Sitemap

Tuesday, November 14, 2017

Prevent auto save in MS CRM

By default auto save is enabled in organization level. We can disable auto save in organization level or form level using small script.

Disabling auto save in organization level:
  1. Go to Settings > Administration.
  2. Choose System Settings.
  3. For the Enable auto-save for all forms option, select No.

Disable auto save in form level:

As there is no setting to disable auto save for a form we have to write down small piece of code as shown below. And register the method on onsave and don't forget to check Pass execution context as first parameter

function preventAutoSave(econtext) {
    var eventArgs = econtext.getEventArgs();
    if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) {
        eventArgs.preventDefault();
    }
}


We have to repeat the same process for the all the forms on which we want to disable autosave. 70 is the save mode for Auto save.

Below are the some interesting points about autosave.

  1. Form will automatically be saved thirty seconds after the change is made.
  2. The field that someone is currently editing isn’t included in an auto-save
  3. If someone else has updated the same record while you’re editing it, those changes will be retrieved and displayed in the form when auto-save occurs.
  4. When auto-save is enabled the record will be saved whenever you navigate away from a record or close a separate window displaying a record.

No comments:

Post a Comment