SharePoint Pals
 | Sign In
CRUD Operation on various field Types in SharePoint List using SPServices – SharePoint 2013
by Ahamed Fazil Buhari 7 Jun 2016
SharePoint Developer
Today  :   7     Total  :    3092

In this article, let us see some of the basic operations on various field types in SharePoint List using SPServices.

Before dealing with SPServices in SharePoint 2013, Let us go through the definitions of SPServices from MSDN

- SPServices is a jQuery library which abstracts SharePoint's Web Services and makes them easier to use.

- It also includes functions which use the various Web Service operations to provide more useful (and cool) capabilities.

- It works entirely client side and requires no server install.

Here, you can find Create operation on different SharePoint field types namely –

· Single line of text

· Multiple line of text

· Date

· People picker

· Lookup (Single & Multiple)

· Choice.

In this article, let us have a look on the Item Creation: The rest of the operations, I am leaving to the readers.

 var valuePair = []; //Array variable to hold all the Field_Internal_Name and its value.
 valuePair.push(["Column_Text1_InternalName", colText1]); 
 //Single line of text field
 valuePair.push(["Lookup_single_InternalName", Lookup_FieldID +';#'+LookupText]); 
 //Lookup field
 // Lookup_FieldID -> ID of lookup list item which has been selected
 // LookupText -> Text of lookup list item which has been selected
 var isoDate = {extracted_Date}.toISOString(); //Date Field
 //convert the date value into ISOString() format which is understandable by SharePoint
 valuePair.push(["Date_InternalName", isoDate]);
 var peoplePicker = $("[id$='PeoplePicker_ID']>span>div").attr("key"); 
 // People picker field
 var userID = null;
     operation: "GetUserInfo",
     async: false,
     userLoginName: peoplePicker,
     completefunc: function (xData, Status) {
         $(xData.responseXML).find("User").each(function() {
             userID = $(this).attr("ID");
 valuePair.push(["Peoplepicker_InternalName, userID]);
 //SPServices accepts User ID for people picker field while creation of new item
 valuePair.push(["Lookup_multiple_InternalName", Lookup_FieldID1 +';#'+LookupText1 + ';#' + Lookup_FieldID2 + ';#' + LookupText1 ]);
 // LookupText -> ID of lookup list item which has been selected
 // LookupText -> Text of lookup list item which has been selected
 //To save multiple lookup field -> append ‘;#’ after every ID, text and next value
 //SPServices to Create an Item.
     operation: "UpdateListItems",
     async: false,
     listName: "Name of the list",
     batchCmd: "New",
     valuepairs: valuePair,
     completefunc: function (xData, Status) {
         if (Status != "success" || $(xData.responseXML).find('ErrorCode').text() !== "0x00000000") {
             alert("Error in saving the item.");
         else {
             if (Status == "success") {
                 alert("Item created successfully...");

Though this is very straight forward, this will save a lot of development effort for sure.

Click HERE to download the SPService JQuery Plugin.

Happy Coding,

Ahamed Buhari

blog comments powered by Disqus

SharePoint Pals

SharePoint Pals, a community portal for SharePoint developers, Administrators and End Users. Let's join hands and share the point together.
Read this on mobile


Angular Js Training In Chennai
Advanced Angular Js training with real world developer scenarios
Angular Js, Web Api and Ionic for .Net Developers
All in one client side application development for .Net developers
Angular Js For SharePoint Developers
Get ready for the future. Its no more just C#

Get Connected

SharePoint Resources

SharePoint 2013 and 2010 Web Parts
Free Web Parts with Source Code for SharePoint Community

SharePoint 2013 Books and Tutorials
Collection of free SharePoint 2013 books and tutorials (eBooks, pdfs)

Supported By

Contribute your article and be eligible for a one month Free Subscription for Plural Sight. The Author of the most popular New Article (published in the previous month) will be awarded with a Free One month Plural Sight Subscription. Article can be sent to in a word document.

Related Resources

Recent Tweets

Twitter October 23, 22:21
How to Add/Remove User Custom Actions (in Site Actions Menu) Programmatically using CSOM PNP in SharePoint -

Twitter October 21, 21:34
How to Add a JS Link Reference to the Display Form or Any other ASPX Programmatically using CSOM PNP in SharePoint -

Twitter October 20, 13:01
How to Add a JS Link Reference to the NewForm and EditForm Programmatically using CSOM PNP in SharePoint Office 365-

Twitter October 12, 12:15
How to Deploy Provider Hosted Apps (Add-Ins) by App Stapling in SharePoint Office 365 -

Twitter October 11, 13:39
How to Deploy Provider HostedApp programmatically using CSOM in SharePoint Office 365 Activating Developer Feature -

Follow us @SharePointPals
Note: For Customization and Configuration, CheckOutRecent Tweets Documentation