Trying to create a new list item in and store the created item's ID in a variable for later usage. (in SharepointOnline 2010) I'm able to create the item perfectly fine but not able to get the ID of the resulting object.
My current solution is to make an ajax request using UpdateListItems to create the item and then in the success callback function try find and ID in the resulting object.
var onsuccessArg = function (data) {
$(data).find('z\\:row').each(function () {
savedItemID = $(this).attr('ows_ID');
});
};
So the list item is created successfully and onSuccess is called. But the each clause is never entered.
At first I thought there was a browser issue with find('z\\:row')
but I've looked at the data
object it in the chrome debugger and I can see that while a <z:row>
element does exist it does not contain any child nodes! So it's like the service hasn't returned any items, even though it did create a list item successfully.
Why could that be?
I Should I be able to get the created list item id this way, right? Am I just missing something or is my approach incorrect? Could there be some weird issue with the server that's causing this? I think that this code has been working fine previously
Edit: For some reason not able to paste the entire code into the post. So here's a pastebin instead http://pastebin.com/iGrvytgn