so I use quite a bit of the javascript client object model for CRUD operations to lists from custom pages (inputs) and I have found that I get version conflict errors on saves from time to time....its very intermittent which has made it more confusing to me.
I can't seem to find anything on this error, except discussions in other boards, etc and the few things I have seen there I have tried but I still get these.
One suggestion was getById(#) gets cached, so instead of getting list items that way, use CAML for the id filtering....no big deal; easy to fix that then but it doesn't seem to help. I believe that my updates are what is throwing this error, but then again I don't even know the basic principle with why. If I have a loop for each item that meets criterion I want to call an update for that item which means there may be several:
for ( var I = 0 ; I < myDataObj; I++ ) {
var thisData = myDataObj[I];
if (thisData.thisVal == thisOtherVal) {
updateThisItem(thisData.thisItemId, thisData.thisVal);
}
}
function updateThisItem(thisId, thisUpdateVal) {
var clientContext = new SP.ClientContext(siteUrl);
var oList = clientContext.get_web().get_lists().getByTitle('myListName');
this.oListItem = oList.getItemById(thisId);
oListItem.set_item(Custom, thisUpdateVal);
oListItem.update();
clientContext.executeQueryAsync(Function.createDelegate(this, this.onUpdatedItemSuccess), Function.createDelegate(this, this.onUpdatedItemFailed));
}
function onUpdatedItemSuccess() {
alert('item updated');
}
function onUpdatedItemFailed(sender, args) {
// sometimes I get error: version conflict
}
when I do get that error though, the item from what I can see has still been updated?