Link to home
Start Free TrialLog in
Avatar of Isaac
IsaacFlag for United States of America

asked on

CMAL Query - Jsom

Hi All,

I am using JSOM to try and retrieve values from SharePoint and filtering by using caml.
Unfortunately, all results are returned ignoring the caml query.  I did use u2u query builder to generate the caml query code and it works in the u2u environment so not sure why it's not working in my code.

var clientContext = new SP.ClientContext();
		var oList = clientContext.get_web().get_lists().getByTitle('ParkFundingForm');
		
		var camlQuery = new SP.CamlQuery();
			camlQuery.set_viewXml(
					   '<Query>'+
					   '<Where>'+
					      '<Eq>'+
					         '<FieldRef Name=\'Title\' />'+
					         '<Value Type=\'Text\'>another test</Value>'+
					      '</Eq>'+
					   '</Where>'+
					'</Query>'+
					'<ViewFields>'+
					   '<FieldRef Name=\'Title\' />'+
					   '<FieldRef Name=\'ProjectName\' />'+
					   '<FieldRef Name=\'PriorityNumber\' />'+
					   '<FieldRef Name=\'ID\' />'+
					   '<FieldRef Name=\'ParkID\' />'+
					   '<FieldRef Name=\'ProjectNumber\' />'+
					'</ViewFields>'
			   );
	  
		this.collListItem = oList.getItems(camlQuery);
		
		clientContext.load(collListItem);

Open in new window


Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of Isaac
Isaac
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial