I have a requirement to build a report from a list filtering by a certain criteria. One of the fields that is supposed to show up in my report is a people's field that allows both people and groups in that field I am using the following code to get the list item, but I cannot get the value in my people's field.
Your help is appreciated.
function getAudits() {
var ListName = 'Mylist';
var ctx = SP.ClientContext.get_current();
var list = ctx.get_web().get_lists().getByTitle(ListName);
var caml = SP.CamlQuery.createAllItemsQuery();
caml.set_viewXml('View><Query></Query></View>');
this.items = list.getItems(caml);
ctx.load(this.items);
ctx.executeQueryAsync(Function.createDelegate(this, this.onSucceededAuditsCallback), Function.createDelegate(this, this.onFailedAuditsCallback));
}
function onSucceededAuditsCallback()
{
// alert('Success');
while (ListEnumerator.moveNext()) {
var currentItem = ListEnumerator.get_current();
var itemID = currentItem.get_item('ID');
var Contributors = currentItem.get_item("Contributors").get_lookupValue();
alert(Contributors);
}
}
faye fouladi