POWEROBJECTS

718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

Autosave is a new feature of Dynamics CRM 2013 that allows a form that is currently being edited to be saved automatically every 30 seconds. This is enabled by default at the Organization level but you can disable autosave for individual forms by using a JavaScript library, an OnSave event and a function call.

tips-and-tricks

This trigger only fires after a new record has been saved for the first time or when you navigate off of a changed field on an existing record.

The downside to Autosave is that data is retrieved from the server each time the Autosave trigger fires. This means that if two people are editing the same record, the other users’ edits will appear on your form after the 30 second Autosave is complete.

For our example, we will use the default Letter activity form. The following steps will help you disable Autosave for this individual form.

Create the JavaScript library ‘AutosaveFunctions.js’ and include the following code:

Click Settings within the main navigation bar.

Select the option for Customize the System.

Expand the Entities section within Components and navigate to the Main form of the Entity that you want to disable Autosave for. Double-click the Main (Letter) form.

Once the Form editor opens, click Form Properties and then Add, within Form Libraries:

When the Look Up Record screen opens, click New. This is where you will add your JavaScript library.

Name your new web resource ‘JavaScript Library’ AutosaveFunctions and be sure to select Script (JScript) from the dropdown list box.

Browse and select the JavaScript Library that you created in Step 1.

 

Once you’ve finished with the highlighted fields on the New Web Resource screen, be sure to click Save and Publish. Now you can close this screen.

 

On the Look-Up Record screen, if your new Web Resource isn’t automatically selected, go ahead and search for it, select it and choose Add.

 

Now let’s go ahead and bind the OnSave event to the new function within the JavaScript Library that you just added.

Click the OnLoad text value from the Event Handlers section and select the OnSave event.

Once selected, go ahead and enter the following values, as this screenshot suggests. Be sure that you click the ‘Pass execution list of parameters that will be passed to the function‘ checkbox.

Click Ok twice and you should be back on the Edit form screen. From here, simply Save and Publish your changes.



Now open an existing activity and modify one of the fields. Tab off of the field and wait 30 seconds. You will see the text ‘unsaved changes’ next to a save icon near the bottom right of the activity window. After 30 seconds, this text should remain here, with the activity unsaved.

And that’s it! We hope you enjoyed this post. Make sure to check in with our Dynamics CRM Education department or our fantastic Dynamics CRM blog for even more tips and tricks!

 

Happy CRM’ing!

 

 

Avatar for JoeCRM

JoeCRM

Joe CRM is a CRM superhero who runs on pure Microsoft Dynamics CRM adrenaline. As the face of PowerObjects, Joe CRM’s mission is to reveal innovative ways to use Dynamics CRM and bring the application to more businesses and organizations around the world.