Version Conflict Issue with SPServices Update in Javascript

May 21, 2015 at 5:46 PM
Hey everyone,

I'm using SPServices.GetListItems to retrieve values from a sharepoint list (dates) which I'm then doing some math to before I update another sharepoint list. In my update function below, I'm getting an error message when the code runs on load of the page I'm working on in which "Failed. Message: Version Conflict." I've read online and found that the issue is the owshiddenversion field needs to be incremented after my update so that there is no "stale data" when repeated updates happen to the same record. Can someone please advise me as to how to modify this value so that I can eliminate the error message? Here is my update script:

var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('Business Case Milestones');

var currentItem = oList.getItemById(ItemId);



clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.failed));

I understand that I need to insert code similar to the following line in order to fix this, but I'm not sure how to find the value I need to make it work:

currentItem.set_item('owshiddenversion', someValueThatYouHaveToFigureOut);

How do I find out what that "somevalue..." is that I need to use?

May 21, 2015 at 7:41 PM
Nothing you're doing here is SPServices-based; it's actually all CSOM. I'd suggest the you post the question on StackOverflow instead. (I don't ever use CSOM!)