Get List Item Field Details using JSOM

18 Jan 2015 One-minute read Al Eardley
On-PremMicrosoft 365

Due to the different types of fields used in list items there are several different techniques that can be used:

SP.ListItem.get\_contentType() - Retrieves the name of the content type of a list item

SP.ListItem.get\_displayName() – Retrieves the display name of a list item

SP.ListItem.get\_id() - Retrieves the id of a list item

SP.ListItem.get\_item(‘{InternalFieldName}’) – Retrieve the value

SP.ListItem.get\_item(‘{InternalFieldName}’).get_url() – Retrieve an associated url value if the field type is hyperlink

SP.ListItem.get\_item(‘{InternalFieldName}’).get_description() – Retrieve the description associated with the field

SP.ListItem.get\_item(‘{InternalFieldName}’).get_lookupValue() – If the field is a person field or any other type of lookup, get the lookup value

SP.ListItem.get\_item(‘{InternalFieldName}’).get_lookupID() – If the field is a person field or any other type of lookup, get the lookup id

In the above examples replace {InternalFieldName} with the internal name of a field.

Further reading

There are many other types of field and to delve deeper into the methods available, refer to the MSDN entries for the SP.Field{Type}. The get\_item() function will return an object of the appropriate type for the field.


MSDN: SP.ListItem

MSDN: SP.Field

MSDN: SP.FieldLookupValue

MSDN: SP.FieldUrlValue

Comment on this post: