Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

JavaScript I am not able to retrieve the value of a people's field from my list items.

$
0
0

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');

      var ListEnumerator = this.items.getEnumerator();
            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


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>