2

I have a SharePoint list form (edit form) that when saved reloads the same edit form. To do this, I overwrote the onclick event on the Save button to construct the URL to redirect to once the form has saved. This URL gets passed to the WebForm_DoPostBackWithOptions JavaScript method that is defined by SharePoint.

Example:

var savebutton = $('input[id$="SaveItem"]');
var saveElementName = savebutton.attr("name");

savebutton.removeAttr("onclick");
savebutton.click(function() {
    var postbackURL = GetTargetDetails(); // method that returns the current form URL

    // --- more validations

    // standard SharePoint logic
    if (!PreSaveItem()) return false;
    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(saveElementName, "", true, "", postbackURL, false, true));
});

When the subsequent page is re-loaded and the save button pressed again, I am presented with the standard SharePoint save conflict error:

enter image description here

I am the only user accessing the list item during these tests so I'm not sure what is exactly causing the conflict. This is a requirement for our SharePoint site to have form pages re-loaded after being saved. If anyone has any insight into the issue that I am experiencing, I would appreciate it.

  • 1
    Any workflows that run once that item is saved? – Alex Chance May 2 '16 at 20:14
  • There is a SP 2013 workflow that runs when the list item is updated. It checks the value of a field within the list and determines based on the value provided if another workflow needs to be called for more processing. If a value is found, it is cleared from the list before triggering the child workflow. – Eric Paulsen May 3 '16 at 14:18
  • I have encountered similar save conflict errors when a workflow is running on a list item, which is why I asked. Are you immediately attempting to save again after the page reloads, or is there some delay between attempts? It could be possible that the workflow is still processing and that is causing the error. – Alex Chance May 3 '16 at 14:26
  • I've tried both approaches (saving right away and waiting a bit before saving), but was still getting the save conflict. Since I am re-loading the edit form right away, I assume that I will almost always be in conflict since the workflow will almost always be processing at that time. Sure enough, disabling the automatic trigger of the workflow caused the save conflict errors to go away. – Eric Paulsen May 3 '16 at 14:41
  • Yeah, I had a problem with a workflow causing this last year and it drove me crazy for a few days. Not sure how to handle the workflow processing in your case. – Alex Chance May 3 '16 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.