Showing posts with label SPServices. Show all posts
Showing posts with label SPServices. Show all posts

Wednesday, October 28, 2015

How to get login user Manager using SPServices?

var managerName;
$().SPServices({
operation: "GetUserProfileByName",
async: false,
AccountName: $().SPServices.SPGetCurrentUser(),
completefunc: function (xData, Status) {
$(xData.responseXML).find("PropertyData > Name:contains('Manager')").each(function() {
managerName = $(this).parent().find("Values").text();
alert(managerName);
});
}
});

Monday, October 19, 2015

How to get with the same titles get number of List Items Count using SPServices

Script:
<script language="javascript" type="text/javascript">

  $(function() {

getcount();
});
function getcount()
{  
    var dataCount=0;
    var queryText = "<Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>Apple</Value></Eq></Where></Query>";
 
    $().SPServices({

        operation: "GetListItems",
        listName: "Furits",
        async: false,
        CAMLQuery: queryText,
        completefunc: function (xData, status) {          
            dataCount= $(xData.responseXML.xml).find("rs\\:data, data").attr("ItemCount");        
//In dataCount  variable ,We will get list items Count
            $("#txtcount").val(dataCount);

        }
    });
           }

</script>

HTML
<input type="text" id="txtcount"/>
 <a onclick="javascript:getcount();">Click Here</a>

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);
 
});
}
});

Thursday, October 1, 2015

SPServices:How to get firstname and lastname and Current Date in Jquery?

In this below script,get firstname and lastname and Current Date in Jquery

get firstname and lastname and Current Date in Jquery
 var fuser= $().SPServices.SPGetCurrentUser({fieldName: "FirstName",

debug: false}); var luser= $().SPServices.SPGetCurrentUser({fieldName: "LastName",

debug: false});

$("#loginuser").html(fuser   +luser);
$("#currentDate").html(new Date());