I'm attempting to use SP services to get some information from a list. Everything seems to be going fine except for one column in the list.

The column in question is a drop down selection of choices for which not every entry has populated with information.

Using the console I can see every other table I setup in the viewfield except for the status field. Any ideas why? Oh Also this is using sharepoint 365 and using the same CAML query with a 3rd Party tool I get back a table of results including the status column.

Here is the code:

query = "<Query><Where><Geq><FieldRef Name='JobCreationDate' /><Value Type='DateTime'>2012-10-31T12:00:00Z</Value></Geq></Where></Query>";

query = "<Query><Where><Geq><FieldRef Name='JobCreationDate' /><Value Type='DateTime'>2012-10-31T12:00:00Z</Value></Geq></Where></Query>";

        webURL: siteURL,
        operation: "GetListItems",
        listName: listName,

        CAMLQuery: query,
        CAMLViewFields: viewFields,
        completefunc: function (xData, Status) 
            debug = $().SPServices.SPDebugXMLHttpResult({
            node: xData.responseXML

            //$("#DeltaFormDigest").html("").append("<b>This is the output from the GetList operation:</b>" + debug);
            alert("There is no data");
                    tmp = xData;
                    //SET DEFAULT VALUES
                    var theData ="";
                    var dueDate;
                    var finalDueDate;

                    //LOAD ALL OF THE VALUES
                    var projectStatus = $(this).attr('ows_Status');
                    var businessUnit = $(this).attr('ows_JobType');
                    var shortName = $(this).attr('ows_ProjectName');
                    var projectName = $(this).attr('ows_ProjectName');
                    var projectManager = $(this).attr('ows_ProjectManager');
//...Code continues on from this point

If the particular item does not contain a value in that field, it is not returned in the XML. So in your output, you'd need to do something like this in the each function of your completefunc:

var theChoiceField;
if ($(this).attr('ows_ChoiceField')) {theChoiceField = $(this).attr('ows_ChoiceField')}
else {theChoiceField = "Not Supplied"; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.