You can following below steps to disable auto save , it is organization level settings, once you set “No” auto save will not work on any entity.
- Click on 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”
1.Write following JavaScript code in your entity JavaScript file.
function preventAutoSave(econtext) {
var eventArgs = econtext.getEventArgs();
if (eventArgs.getSaveMode() == 70) {
eventArgs.preventDefault();
}
}
2. In the Form Properties window, in the Event Handlers section, set Event to OnSave.
3. Click on Add and choose the above code written JavaScript resource file
4. In the Handler Properties window, set Library to the web resource you added in the previous step.
5. Type ‘preventAutoSave’ in the Function field. This is case sensitive. Do not include quotation marks.
6. Make sure that Enabled is checked.
7. Check Pass execution context as first parameter.
8. Click OK to close the Handler Properties dialog.
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.