I am trying to build CAML Query that pulls items from a SharePoint 2013 list with a "Status" value of "COMPLETED", but instead this query returns all list items regardless of the value of "Status". Any ideas why this is happening?
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(
'<View>' +
'<Query>' +
'<Where>' +
'<Geq>' +
'<FieldRef Name=\'Status\'/>' +
'<Value Type=\'Text\'><COMPLETED/></Value>' +
'<RowLimit>10</RowLimit>' +
'<Geq>' +
'</Where>' +
'</Query>' +
'</View>');
Please check that you are putting right status value in "Value" tag - no typos, no need to do extra uppercase or lowercase. Use it just like it stored in SP. Also try to use "Contains" element in your query:
Good luck!