0

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 UpdateField(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());  
            }); 
    });
}

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.