I am trying to get values of few lookup columns and person or group column of my list using the below code
var context = SP.ClientContext.get_current();
var web=context.get_web();
var list=web.get_lists();
var targetList;
targetList = list.getByTitle("list name");
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Text'>"+myID+"</Value></Eq></Where></Query></View>");
window.collListItem = targetList.getItems(camlQuery);
context.load(collListItem);
context.executeQueryAsync(Function.createDelegate(this, onQuerySucceeded),Function.createDelegate(this, onQueryFailed));
function onQuerySucceeded(sender,args)
{
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
var a = oListItem.get_item('lookup column').get_lookupValue();
var b = oListItem.get_item('person or group').get_lookupValue();
}
function onQueryFailed(sender,args){alert('failed');}
But it throws error
The property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
How to get the value of those columns?