Wednesday, October 7, 2015

How to get the id of the last inserted row in SharePoint list and SPServices RowLimit




$(document).ready(function() {
 //alert("ASD");
 var idquery="<Query><OrderBy><FieldRef Name='ID' Ascending='True' /></OrderBy></Query>";
    $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "test",
    CAMLQuery: idquery,
    CAMLRowLimit: 1,
     completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
      //alert($(this).attr("ows_Title"));
      var getvalue= parseInt($(this).attr("ows_Title"))+1;/Auto increment value
      $("input[title='TicketNumber']").val(getvalue);
 
});
}
});

No comments:

Post a Comment