1

I am retrieving a list that contains Persons and would like to convert them to String, and also be able to count how many users are per list. The Person is retrieved as an Object. How can I solve this issue?

var oListItem = listItemEnumerator.get_current();
itemValue = oListItem.get_item('Title');
alert(itemValue); //prints correctly
peopleValue = oListItem.get_item('People').get_lookupId();
alert("My name is" + peopleValue); //prints [object, object]

1 Answer 1

1

Using get_lookupValue() should work.

If you're reading out a multi user it's slightly different too.

//Get user field value
var peopleVal = item.get_item('People').get_lookupValue();


//Get multi user field value
var peopleVals = item.get_item('People');
for(var i = 0; i < peopleVals.length;i++) {
     var userName = peopleVals[i].get_lookupValue();   
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.