Asked by:
CRM 2013 - Save event is called when I do F5 on browser.

Question
-
Hi,
In CRM 2013, on form load I am making some changes to hidden attributes. This results it showing "unsaved changes" message on right bottom corner of the entity form.
Now when I try to refresh the form (F5), it is triggering Save event and it shows alert message which was otherwise intended to show only when User clicks on Save or Save&Close button in entity form.
When I checked ExecutionObj.getEventArgs().getSaveMode() the mode is 2 (Save and Close). I have auto save disabled for my Org.
What could be problem here?
Thanks
Mak
MaKeer | myencounterwithcrm.wordpress.com | CRM2011 User Settings Utility | CRM2011 Lookup Preview | CRM2011 Lookup Attribute Mapping | CRM2011 TreeView Control (Beta) | CRM2011 N:N Entity View (Beta) | CRM 2011 Global Quick Search (Beta)
Thursday, March 27, 2014 7:03 PM
All replies
-
Are you Online or On Premise? Or more specifically which UR is installed?
RTM and UR1 with auto save disabled throws the "Save and Close" savemode when navigating off a record when auto save is disabled.
It assumed even with auto save off that you still want to save data in the event of navigating off the page.
With UR the behavior changed to more like people would expect, navigating off the page no longer attempts to save data in this manner.Hope this helps
Jason Lattimer
My Blog - Follow me on Twitter - LinkedIn- Proposed as answer by JLattimerMVP, Moderator Thursday, March 27, 2014 8:40 PM
Thursday, March 27, 2014 8:39 PMModerator -
We are On Premise with UR1. I will confirm the fix once we install UR2.
Thanks
Mak
MaKeer | myencounterwithcrm.wordpress.com | CRM2011 User Settings Utility | CRM2011 Lookup Preview | CRM2011 Lookup Attribute Mapping | CRM2011 TreeView Control (Beta) | CRM2011 N:N Entity View (Beta) | CRM 2011 Global Quick Search (Beta)
Thursday, March 27, 2014 8:55 PM -
Hi Jason,
Even after installing UR2 ((6.0.2.46) (DB 6.0.2.46)), I am still seen same behavior. That is Save event getting called on F5 even after auto save is disabled for entire Org.
Thanks
Mak
MaKeer | myencounterwithcrm.wordpress.com | CRM2011 User Settings Utility | CRM2011 Lookup Preview | CRM2011 Lookup Attribute Mapping | CRM2011 TreeView Control (Beta) | CRM2011 N:N Entity View (Beta) | CRM 2011 Global Quick Search (Beta)
Friday, March 28, 2014 6:52 PM -
as per SDK Help
The OnSave event occurs when:
- The user clicks the
button in the lower right corner of the form, even when there is no changed data to be saved.
- Code executes the Xrm.Page.data.entity.save method, even when there is no changed data to be saved.
- The user navigates away from the form and there is unsaved data in the form.
- With auto-save is enabled, 30 seconds after data has changed and there is unsaved data in the form.
- Code executes the Xrm.Page.data.save method and there is unsaved data in the form.
- Code executes the Xrm.Page.data.refresh method passing a true value as the first parameter and there is unsaved data in the form.
To determine which button was clicked to perform the save, use the getSaveMode method.
So its expected behavior when F5 is clicked and if there are unsaved changes OnSave will get triggered, however my problem is what is SaveMode in this case?
MaKeer | myencounterwithcrm.wordpress.com | CRM2011 User Settings Utility | CRM2011 Lookup Preview | CRM2011 Lookup Attribute Mapping | CRM2011 TreeView Control (Beta) | CRM2011 N:N Entity View (Beta) | CRM 2011 Global Quick Search (Beta)
Thursday, November 6, 2014 11:39 PM - The user clicks the