Disable auto save functionality in Dynamics CRM 2013

In Microsoft Dynamics CRM 2013, you no longer need to click or tap Save when you’re editing. It has the ability to save records automatically when you create new record or update existing record. While editing a record, CRM automatically saves the record every 30 seconds and when you close the record or go to other page, it gets automatically saved. By default, the system automatically saves any edited records every 30 seconds, or when you navigate to another record.

Sometimes it might cause performance issues, If you have plug-ins, workflows, or form scripts that execute when a record is saved, they’ll run each time auto-save occurs. This might lead to undesirable behaviors if these extensions weren’t designed to work with auto-save.

This feature can also be disabled at organization level in the System Settings, if anyone is not interested to use.

  1. Click on Dynamics CRM-> Settings tile
  2. Click on Settings-> Administration tile
  3. Click on System Settings icon
  4. Set “No” to “Enable auto save on all forms” under “Select the default save option for forms”

Note: Since it is organization level settings, once you set “No” auto save will not work on any entity. There is no option to disable autosave at the entity or form level, but a small script can be added to the OnSave event of a form that will disable it on the form level. Check out below how to do this.

AutoSave1

Configure the OnSave event:

  1. Write following JavaScript code in your entity JavaScript file.
  2. function preventAutoSave(econtext) {
        var eventArgs = econtext.getEventArgs();
        if (eventArgs.getSaveMode() == 70) {
            eventArgs.preventDefault();
        }
    }
    
  3. In the Form Properties window, in the Event Handlers section, set Event to OnSave.
  4. Click on Add  and choose the above code written JavaScript resource file
  5. In the Handler Properties window, set Library to the web resource you added in the previous step.
  6. Type ‘preventAutoSave’ in the Function field. This is case sensitive. Do not include quotation marks.
  7. Make sure that Enabled is checked.
  8. Check Pass execution context as first parameter.
  9. Click OK to close the Handler Properties dialog.
  10. The Handler Properties dialog should look like this.

AutoSave2

After you apply this script to the OnSave event, when people edit a record using this form the message unsaved changes will appear in the bottom right corner of the form just as it would if auto-save was not disabled. But this message will not go away until people click the Save button next to it.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s