Monday, 21 December 2015

Resolving SharePoint 2013 Page Save Conflict Error

I was working on a custom web part that used to update the page library custom column in edit mode. After the changes are updated by web part using client side JSOM, the save conflict error used to be thrown by the page.

This is not a multi-user scenario, but a use case when page property is updated by custom web part in edit mode by JSOM and then if page is saved/checked-in, you get Page Save conflict error.

Reason: When ever page is loaded in edit mode, the version (owshiddenversion) of it is saved in the page hidden field, thus when page is saved, the current version of the page item is checked with saved version. And if there is any mis-match, conflict error is thrown by SharePoint and pop-up is launched.

Solution: Update page item property is updated, reload the page list item and update the hidden field "SPPageStateContext_PreviousAuthoringVersion" with latest "owshiddenversion"

This will ensure that when ever page is saved, it is updated with latest version and page conflict error is not raised. 

No comments:

Post a Comment