locked
Save Conflict Error RRS feed

  • Question

  • Hello Friends,

    I am getting following error

    Save Conflict Error:

    "My Name" is editing this page and has made changes which conflict with yours. It is recommended that you stop modifying this page until the other user is finished. What would you like to do.

    I will explain the scenario here..

    I have a page which contains the 5 taxonomywebTagging Control created at runtime using JSOM. I cannot make it static due to client requirement. I have created the update button. Onclick of this button these taxonomy values are getting updated in Pages Document Library. But problem arises when I update the contents of page and hit the update button after that  click on Save or Check-in the page. It throws the Save Conflict Error.

    Surprisingly it gives my name on the error message. Please help me understand this problem.

    Detailed Error message is as follow.

    "Sharma, Vikas is editing this page and has made changes which conflict with yours. It is recommended that you stop modifying this page until the other user is finished. What would you like to do?

     Continue Editing: You will have to manually merge your changes later.
     Merge Changes: Open another window and copy your changes into that window.
     Discard Your Changes: Stop editing this page and delete all your changes.
     Overwrite the Page: Delete the other user's changes and replace them with your own."

    function UpdateMMSField(termValue)
    {
    
        var id1 = _spPageContextInfo.pageItemId;
        var taxField='';
        var field=[];
        this.TermValue =termValue;
        this.TermLable =[];
        this.TermID =[];
        ctx = SP.ClientContext.get_current();
        this.web = ctx.get_web();
    
    	    this.oList = this.web.get_lists().getByTitle('Pages');
    	    this.oListItem = oList.getItemById(id1);
    		
    	// my code goes here
    	       
    	ctx.load(oListItem);
        
        ctx.executeQueryAsync(
    	    function()
    	    {
    	    	var termSetId='';
    	    	var termId='';
    	    	var stermValue='';
    
    	    	for(i=0;i<TaxFields.length;i++)
    	    	{
    	    		var taxField=context.castTo(field[i], SP.Taxonomy.TaxonomyField);
    	    		termSetId = taxField.get_termSetId().toString();
    	    		
    	           	if(TermLable[i]!='' && TermLable[i]!='undefined')
    	           	{
    					stermValue = new SP.Taxonomy.TaxonomyFieldValue();
    					stermValue.set_label(TermLable[i]);
    					stermValue.set_termGuid(TermID[i]);
    					stermValue.set_wssId(-1);
    					taxField.setFieldValueByValue(oListItem, stermValue);
    					ctx.load(taxField);
    				}
    				else
    				{
    					taxField.validateSetValue(oListItem, null);
    					ctx.load(taxField)
    				}
    
    			}
    			
    
    			oListItem.update();
    
    			ctx.executeQueryAsync(function () 
    				{  
                     alert('Page preferences has been updated');  
                    }
                    
                    , function (sender, args) 
                    
                    {  
                      console.log(args.get_message() + '\n' + args.get_stackTrace());  
                	}
                	); 
    
    	    }
        
        );
    
    }


    V.S.



    • Edited by -Vikas- Monday, May 11, 2015 6:13 AM Editting sample code
    Tuesday, May 5, 2015 9:51 AM

Answers

  • Hi,

    According to your description, my understanding is that when you update multi taxonomy fields in pages library, it throws "Save Conflict" error.

    As you are updating more than one field in the JSOM function, after the first update the list item (oListItem in your case) object will have become stale, and the server will reject the update.

    SharePoint uses a hidden field called owshiddenversion, which gets downloaded along with your CSOM object, to determine which version you are editing. When you send your update, the server checks that owshiddenversion to determine if the data is stale. If that field is not what it expects, the server will reject the update and send that version conflict message.

    For more detailed information,here is a similiar thread for your reference:

    Javascript : How to handle version conflict errors when using javascript COM?

    Thanks

    Best Regards


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Tuesday, May 26, 2015 3:05 AM