This project has moved and is read-only. For the latest updates, please go here.

view / viewFields not returning requested date fields

May 11, 2011 at 8:13 PM

I'm using SPServices / GetListItems, and can retrieve the items I want, but not all the field info.

My list has many fields; the default view displays only a few of them.  So I created a view which displays all the fields I need, and specified this view name on GetListItems.  Most of the fields on my view are in the returned xml, except for two: I need 10 date fields, and am getting only 8 of them.  Two are calculated fields, the rest are ordinary date/time fields.  The two that are missing are ordinary date/time fields. 

I also tried using the viewFields parameter, which in theory, should override the fields which are returned.  However, when I use the viewFields parameter, there are even fewer fields returned (looks like just the required ones), making me think my syntax could be incorrect.  I tried using the field display names, and the internal (ows_..) names, but no luck. 

I do see these fields when I run a query in U2U CAML builder.  Any ideas about why they are not returned in xml?

BTW, I am really grateful for the SPUpdateMultipleListItems function - thank you for that!

(showing viewfields parameter both ways)

var query = "<Query><Where><Or><Eq><FieldRef Name='Status' /><Value Type='Choice'>xxxxx</Value></Eq><Eq><FieldRef Name='Status' /><Value Type='Choice'>yyyyy</Value></Eq></Or></Where></Query>";
var viewfields = "<ViewFields><FieldRef Name='Vendor Name' /><FieldRef Name='Description' /><FieldRef Name='Status' />......</ViewFields>"; 

var viewfields = "<ViewFields><FieldRef Name='ows_ID' /><FieldRef Name='ows_Status' /><FieldRef Name='ows_Description' />....</ViewFields>";

                operation: "GetListItems",
                async: true,
                listName: "{aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}",
                viewName: "{aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee}",
                CAMLQuery: query,
                CAMLViewFields: viewfields,
                CAMLRowLimit: 0,
                completefunc: function (xData, Status) {
                    if (xData.statusText != 'success') {
                        error = "true";
                    $(xData.responseXML).find("[nodeName='z:row']").each(function (i) {

May 11, 2011 at 10:58 PM

Have you tried your code without using the viewName parameter?  All you really need is the CAMLViewFields.

You'll also want to make sure there is data in the columns, if you expect them to show up using U2U.

May 12, 2011 at 4:37 PM

To piggyback on what Matt said, I'd remove all of the filtering and make sure that the data comes back from the list correctly for every item, all columns.

Then layer back in your filtering until you get it the way you want it.