Auto Save feature was introduced during CRM 2013 version and it is still will us today in Dynamics 365 version.
To activate AutoSave feature navigate to Settings ->Administrator –> System Settings -> Under General Tab -> Select Yes.

Some important points about auto save:
- It works for update form means where form type = 2
- It does not work on create form means where form type = 1
- Auto save automatically triggers after 30 seconds.
- Once the auto save feature is enabled the Save button would disappear from the ribbon. User can save the form either by using Ctrl+S or by clicking the save icon which would appear on the right hand bottom side.
- Auto save feature can be enabled or disabled at organisation level. It cannot be enabled or disabled at entity level.
Considering 5 point in mind there are multiple scenarios where the Auto Save feature becomes a bottleneck for user. Example: If an organization has plug-ins, workflows, or jscripts that run on the OnSave event, they will trigger each time when auto-save occurs. This may potentially cause undesirable results especially if these customizations were not designed to work with auto-save.
For disabling the auto-save feature for a form, we will need a webresource of Javascript type.
Below is code logic which can be used for restricting a form from getting auto save.
function preventAutoSave(econtext) { var eventArgs = econtext.getEventArgs(); if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) { eventArgs.preventDefault(); } }
To know more about the Save event arguments(getSaveMode), Click Here.
Value | Save Mode | Entity |
2 | Save and Close | All |
70 | Auto Save | All |
Let’s continue with the same javascript which we have used in our previous blog, I have added a new function formOnSave for preventing the auto save getting triggered.
var Namespace = window.Namespace || {};
(
function (){
this.formOnLoad = function(executionContext)
{
}
//Prevent form from triggering AutoSave
this.formOnSave = function(executionContext)
{
var eventArgs = executionContext.getEventArgs();
if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) {
eventArgs.preventDefault();
}
}
this.validatephonenumber = function(executionContext)
{
var formContext = executionContext.getFormContext();
var phoneNumber = formContext.getAttribute("mobilephone").getValue();
//Using Regular expression
var regexpr = /(((\d{3}) ?)|(\d{3}-))?\d{3}-\d{4}/;
//Uing test for a match in a string. Returns true or false
if(!regexpr.test(phoneNumber))
{
/*Using field notification for displaying the error msg. User won't be able to save the form until the error is cleared up.*/
formContext.getControl("mobilephone").setNotification("Entered Phone number is not in a correct format", "validatephn");
//Using form notification for displaying the msg on the Form.
formContext.ui.setFormNotification("Warning Message", "WARNING", "formwarning");
}
else
{
/*Clear error notfication when the entered phone number is in the correct format. For clearing the notification only uniqueid is required.*/
formContext.getControl("mobilephone").clearNotification("validatephn");
/*Clearing form notification when the criteria is met. For clearing the notification only uniqueid is required.*/
formContext.ui.clearFormNotification("formwarning");
}
}
}
).call(Namespace);
Now, the JScript formOnSave function needs to be called on OnSave event of contact entity form.

Hit the OK button. Save and Publish the changes.
Navigate to the Contact entity form, press Ctrl+F5 for clearing cache.
Now the Auto-Save would not trigger on the Contact entity form. User will need to press Ctrl+S or click on the Save button on the right button side of the screen.