0

I am able to pull sharepoint online list items by following this article https://social.technet.microsoft.com/wiki/contents/articles/37536.sharepoint-online-retrieve-list-items-from-sharepoint-list-using-javascript-object-model-jsom.aspx

but getting this error

Outer Error Message: Cannot read properties of null (reading 'get_lookupValue')

Below is my code, only thing is lookup column name is changed from Title to Surgeon, what is the alternative solution for getting lookup column value in JS

while (listItemEnumerator.moveNext()) {

    var oListItem = listItemEnumerator.get_current();   
    
    var lookupSurgeonField = oListItem.get_item("Surgeon");                                                      
    var lookupSurgeonValue = lookupSurgeonField.get_lookupValue();
 
    listItemInfo += '<strong>ID: </strong> ' + oListItem.get_id() +

    ' <strong> Hosp Number: </strong> ' + oListItem.get_item('Title') + 
    
    ' <strong> Surgeon: </strong> ' + lookupSurgeonValue +

    '<br />';

}
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.