Retrieving the id of an inserted item using sp services

I was working on a project the other day and needed to get the id of an inserted item into a SharePoint 2007 custom list.  I was not even sure if it was possible and if there was any sample code out there.  With faith and my good friend beside me, Google, I began my search.  I searched everywhere and finally came to this helpful site

Here’s how I used the code:

function getID(measureID,FY)
     var newItemID = null;
     operation: "UpdateListItems",
     listName: "Results List",
     batchCmd: "New",
     async: false,
     valuepairs: [
       ["Title", measureID],
       ["FiscalYear", FY]
    completefunc: function(xData, Status) {
           var newId = $(xData.responseXML).SPFilterNode("z:row").attr("ows_ID");
            newItemID = newId;
  return newItemID; 

Hopefully, this blog post can narrow the search on this topic. 🙂

jQuery and SP Services

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: