Various ECMA List field operations in SharePoint 2013

jsom sharepoint

In SharePoint client object model ECMA play key role. I would like to walk you through various methods to access list fields using ECMA scripting.

Note: Like as in C# object model in ECMA also we need to use list field internal name.

SharePoint deveopment training course

This is the default filed will get create as soon as we create a list with Item content type. To read Title field

To read value: ObjListItem.get_item(‘Title’)
To set value: ObjListItem.set_item(‘Title’, “Title Value”);

The default column get creates with the list and it is an auto incremental field.

To get ID: ObjListItem.get_id()

URL/Hyperlink Field: In SharePoint URL field will have to set 2 values 1 is URL and the other one is description.

To get URL value – ObjListItem.get_item(‘urlfieldname’).get_url()
To set URL value – ObjListItem.set_item(‘urlfieldname’,”URL field Value”)
To get description value – ObjListItem.get_item(‘descriptionfieldname’).get_description();
To set description value – ObjListItem.set_item(“descriptionfieldname”,”description Value”);

Setting Hyperlink Field from UI:

Below is the way you can set hyperlink field through UI in SharePoint 2013.

jsom sharepoint 2013
jsom sharepoint 2013

Also read some SharePoint 2013 jsom examples:
Retrieve list item details by id using javascript object model jsom in sharepoint online

SharePoint 2013 get workflow template id programmatically using JavaScript Object model (jsom)

CRUD Operations with ECMA or jsom in SharePoint 2013 and SharePoint 2016 Part-2

Hyperlink list field:

jsom sharepoint
jsom sharepoint

Version Details:
To get the version details of a list item.

To read the version details: ObjListItem.get_item(“_UIVersionString”)

Choice field:
In SharePoint, we have a field to facilitate selecting a single value from list of values.

To get the value: ObjListItem.get_item(‘ChoiceFieldName’)
To set the value: ObjListItem.set_item(‘ChoiceFieldName’,’Choice Value’)

sharepoint javascript examples
sharepoint javascript examples

Created Date:
SharePoint creates the default time stamp as soon as list item get created.

To get the time stamp: objListItem.get_item(“Created”)

Modified Date:
SharePoint also tracks updated date time.

To get the updated time stamp: objListItem. get_item(“Modified”)

Created User Name:
As we learned just before SharePoint keep track of all the operations and user accounts operated with. This will get the Created User Name.

To get the created User Name: objListItem.get_item(“Author”).get_lookupValue()

Modified User Name:
Now that we learned to get the created user, the below will get the modified user name.

Modified User Name: objListItem.get_item(“Editor”).get_lookupValue()

List Item Content Type:
As we learned in the beginning of the article list will get associate with one content type. If we need to know the content type associated with the list item.

To know the Content Type: objListItem.get_contentType()

Hope this helps, happy development in SharePoint Object model.

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)


About Krishna Vandanapu

I am Krishna.Vandanapu a SharePoint architect working in IT from last 13+ years, I worked in SharePoint 2007, 2010, 2013, 2016 and Office 365. I have extensive hands on experience in customizing SharePoint sites from end to end. Expertise in SharePoint migration tools like Sharegate, Doc Ave and Metalogix. Migrated SharePoint sites from SharePoint 2007 to 2010 and 2010 to 2013 several times seamlessly. Implementing CSOM with Microsoft best practices. Spent quality time in configuring SharePoint application services like User Profile, Search, Managed Meta data services etc. Now exploring SharePoint Framework and SharePoint 2019

View all posts by Krishna Vandanapu →