I have a custom list which I am pulling data from using JavaScript. However for some reason it does not pick up two columns when I call them by their name. I have to use console.log(collListItem.getItemAtIndex(0).get_fieldValues()) in the browser console to find the field values and use those names instead.
What's the reason why it won't pick up these columns? Shouldn't it always pick up the columns when called by name? My problem is that if the someone else wants to change the code they won't know where to look. I would like everything to be consistent.
function GetListItems(SPHostUrlKey){
var SPContext = new SP.ClientContext.get_current(SPHostUrlKey);
var web = SPContext.get_web();
var List = web.get_lists().getByTitle("People List");
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><Query><Where><Geq><FieldRef Name=\'ID\'/>' +
'<Value Type=\'Number\'>0</Value></Geq></Where></Query><RowLimit>10</RowLimit></View>');
collListItem = List.getItems(camlQuery);
SPContext.load(collListItem);
SPContext.executeQueryAsync(GetListItemsSuccess, GetListItemsFail);
}
while (listItemEnumerator.moveNext()){
var oListItem = listItemEnumerator.get_current();
title = oListItem.get_item('Title'); //Title of Link
caption = oListItem.get_item('p06v'); //This is internal name of the 'Caption' column
url = oListItem.get_item('URL'); //URL of Links
order = oListItem.get_item('nywb'); //This is internal name of the 'Order' column
//order = oListItem.get_item('Order');
}//End of While Loop