Help reqd with getting only desired fields

Sep 26, 2010 at 8:40 PM


   var siteURL = "http://bi-uat/"; //URL of the site in which the list is contained. 
   var listName = "GMPTest"; //Name of the list
   var viewName = "All Items"; //View Name
   var qry = "<OrderBy><FieldRef Name='ID' Ascending='TRUE' /></OrderBy>" // Query
  var itemsObject = jP.Lists.setSPObject(siteURL,listName).getSPView(viewName).getSPItemsWithQuery(qry).getItemsFieldData(['RequestedDate','Staff','Facility Requirements']).Items;



I need some help with the above query. I wrote this query to only get the fields I want i.e. RequestedDate','Staff','Facility Requirements' in the EXACT order but I don't get the result as desired. What changes are required? thanks


Oct 7, 2010 at 4:24 AM

getSPView() and getSPItemsWithQuery() should be used separately.  The first retrieves list items from a specified view and the second retrieves list items from the default view. 


var itemsObject = jP.Lists.setSPObject(siteURL,listName).getSPItemsWithQuery(qry).getItemsFieldData(['RequestedDate','Staff','Facility Requirements']).Items;

Also use getSPListFields() to verify that the fieldnames used are valid.