Manage Auto Save
Auto save enables automatic save of records at fixed short interval for update without the need for you to explicitly click on “Save” button every time. Now you don’t need to worry about saving record when you are working on a record for a long time. In this blog we are going to discuss more about this.
When you create a new record, you will have to save the record for the first time manually before autosave kicks in. Once the record has been saved , autosave will save any changes made to the record every 30 seconds after a field has been modified. If no changes are made on form than automatic save will not occur.
Plugins will fire on autosave, as will workflows. The audit log will also be updated.
The field that someone is currently editing isn’t included in an auto-save. 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.
During the save, if there are any validation failures, such as invalid data, or missing required fields, etc. that prevent the save, then an error message will show at footer panel below and the auto save will not proceed.
In CRM by default this feature is turned on for all new and updated organizations. Please note that this is applicable only when updating records. If you are creating a new record then you must explicitly save the record. It will not be auto saved. Auto save capability is not applicable to Quick Create forms or Mobile forms. Also, auto save only applies to the Main form. It is also important to note that this feature is only enabled for entities with the updated user experience forms.
How to turn auto save on or off
There may be situations where you want to disable this capability. Because auto save call goes through normal save pipeline. This means all events associated with the form on-save event will be triggered for auto save as well. Server-side plugins and workflows associated with save actions will also be executed.
You may have a scenario where you don’t want save to be triggered automatically at a fixed regular interval. For example, if you have plugins o workflows triggered on the save of a form that have complex business logic associated with them, you might not want them to be called with each auto save. In this case you might want to turn off this setting. In CRM there is an option to turn off this setting which is available in “System settings”.
- On the navigation bar click Administrator > System Settings
- On the general tab, you can find the setting “Select default option for auto save” as shown here:
This is a new field in the organization entity called “IsAutoSaveEnabled” and can be set using the SDK Update method as well. See the CRM 2013 SDK for information on using the Update method.
Please note that this feature can only be controlled at organization level. The feature will be turned on or off for all updated entities.
Please note that this setting only turn-off the auto save on form which happens at every regular interval if changes are made on form. Whether you have auto-save enabled or not, whenever you navigate away from a record or close a separate window displaying a record, the record will be saved.
Disable Auto Save on specific entity we need to write java script code. Below code snippet can be used to prevent auto save on a particular entity. This code has to be called on the onSave event of particular entity.
function preventAutoSave(context) {
var args = context.getEventArgs();
if (args.getSaveMove() == 70) {
args.preventDefault();
// or Xrm.Page.data.setFormDirty(true);
}
}
No comments:
Post a Comment