function getCurrentLoginUserDetails() {
context1 = new SP.ClientContext.get_current();
oList = context1.get_web().get_lists().getByTitle('Employee Annual Leave Records');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(
'<View><Query><Where><Contains><FieldRef Name=\'Title\'/>' +
'<Value Type=\'Text\'>L</Value></Contains></Where>' +
'</Query></View>');
var collListItem = oList.getItems(camlQuery);
context1.load(collListItem);
context1.executeQueryAsync(onQuerySucceededD,onQueryFailedD);
}
function onQuerySucceededD(sender , args) {
var listItemInfo = '';
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
listItemInfo += '\nTitle: ' + oListItem.get_title() +
'\nEmployee Number: ' + oListItem.get_item('Employee_x0020_Number') +
'\nEmployed Date: ' + oListItem.get_item('Employed_x0020_Date');
}
alert(listItemInfo.toString());
}
function onQueryFailedD(sender , args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
I want to retrieve list items from a list name: Employee Annual Leave Records.
My code doesn't show me error.
But my onQuerySucceededD function alert do not show up.
I refer to this. I not really understand it, hope somebody can explain to me??
I am wondering what is the problems.
var collListItem
globally not within the function – Sharique Ansari