How to solve Save conflict error?

Forums Dynamic Forms for SharePoint How to solve Save conflict error?

Viewing 6 reply threads
  • Author
    Posts
    • #34190
      Harsh
      Participant

      While saving the edit form, we are facing a save conflict error, maybe it happened because we have some power to automate flows that change values in columns while the form is in edit mode.
      How can I resolve this?

      Attachments:
    • #34193
      Alexander Bautz
      Keymaster

      If you have a FLOW that changes the item after a user has opened editform and before he saves the item he will get a save conflict.

      To avoid this you can add a field to your list – for example a boolean field named FLOW_DONE – that you set to true when the FLOW has finished.

      Now you can set up a rule in your EditForm that checks this field – and if it is not true, give an alert and tells the user that the item is not yet ready for edit.

      Alexander

    • #34194
      Harsh
      Participant

      Very useful, Thanks @Alexander
      Can you help me with providing steps on how can I set up these rules?

    • #34196
      Alexander Bautz
      Keymaster

      You must edit your FLOW to write to the FLOW_DONE field when it is done.

      In DFFS you just set up a rule that triggers on FLOW_DONE = Unchecked and add a message to the user in the “Alert this message” textarea.

      If you want to redirect the user away from EditForm you can leave the “Alert this message” field empty and instead add this to the “Run these functions / evaluate these rules” textarea:

      flow_not_ready_redirect

      and this to your Custom JS:

      function flow_not_ready_redirect(){
          spjs.modal.add({
              "title": "Item is not ready",
              "html": "The FLOW has not finished updating this item so you cannot edit it.<br><br>Please try again later.",
              "showClose": false,
              "allowMaximize": false,
              "resizable": false,
              "ok": function(){
                  if(GetUrlKeyValue("IsDlg") === "1"){
                      window.frameElement.commitPopup();
                  }else{
                      window.history.back();
                  }
              }
          });
      }

      Alexander

    • #34198
      Harsh
      Participant

      Work exactly the way I want…Thanks, @alexander…!
      Regards
      Harsh.

    • #34960
      SteveE
      Participant

      I really like this and can get it to work on my test form. However on my production form the “back” history shows the same entry multiple times so it doesn’t redirect. It could be because it takes time to load or there are other timeouts on it. I’ve tried to add a timeout but I don’t think it will matter because the “back” history is loaded with the same form. I guess I could redirect it somewhere else, but is there any way to get it to go back to the view they were at other than the “back” history? Maybe something with the source in the url? Thank you!

    • #34962
      SteveE
      Participant

      Can I trigger the cancel button functionality instead?

      • #34968
        Alexander Bautz
        Keymaster

        You can replace this line to use the Cancel button:

        window.history.back();

        with this:

        jQuery("input[id$='_diidIOGoBack']:first").trigger("click");

        Alexander

      • #34970
        SteveE
        Participant

        Sweet! That did it. Thanks!

Viewing 6 reply threads
  • You must be logged in to reply to this topic.