I have two lists CharitySlots and CharityBooking.CharityBooking has a lookup field into CharitySlots. CharitySlots has a Lookup (calculated field) to count the number of slots taken. I run an event when a slot is selected (dropdown) and would want to query CharitySlots where the field equals the selected dropwon value and pop up a message with the field value.
here is the code that is giving me problems:
function DisplayMessage()
{
var clientContext = SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('CharityDaySlots');
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<Where><Eq><FieldRef Name=\'SlotsOriginal\'/><Value Text=\'Text\'>10 July 2017 08:00</Value></Eq></Where>');
var collListItem = oList.getItems(camlQuery);
this.collListItem = oList.getItems(camlQuery);
clientContext.load(collListItem);
clientContext.executeQueryAsync(onSucceededCallback, onFailedCallback);
function onSucceededCallback() {
var markup = 'Items in the CharityDaySlots list slots 10 July 2017 08:00': <br><br>';
//pop up message witht the item in SlotsOriginal field
alert(collListItem.get_item('SlotsOriginal'));
}
function onFailedCallback(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
}