Disable AutoSave Functionality in CRM 2013/2015


Microsoft Dynamics CRM 2013/2015 has the ability to save records every 30 seconds automatically when you create new record or update existing 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

  • Dynamics CRM-> Settings tile
  • Click on Settings-> Administration tile
  • Click on System Settings icon
  • Set No to Enable auto save on all forms under Select the default save option for forms. 

Since it is organization level settings, once you set No auto save will not work on any entity. There is no option to disable auto save 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.

  • Write following JavaScript code in your entity JavaScript file.

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

  • In the Form Properties window, in the Event Handlers section, set Event to OnSave.
  • Click on Add and choose the above code written JavaScript resource file
  • In the Handler Properties window, set Library to the web resource you added in the previous step.
  • Type preventAutoSave in the Function field. This is case sensitive. Do not include quotation marks.
  • Make sure that Enabled is checked.
  • Check Pass execution context as first parameter.
  • Click OK to close the Handler Properties dialog.
  • The Handler Properties dialog should look like this.

For more information on SaveEventArguements
 
Hope this helps.


Happy CRM’ing
Gopinath.

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s