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

GetListItemsJson doesn't return all expected fields

Jan 13, 2015 at 9:50 AM

first of all thank you for this great library, it's really awesome.

I am using SPGetListItemsJson function in a document library and I encountered an issue I haven't been able to deal with. When I try to retrieve data from my document library everything goes well, but I don't get all fields I request. Here is the code:
var listItems = $().SPServices.SPGetListItemsJson({
    listName: "myListName",
    CAMLViewFields: "<ViewFields Properties='True'><FieldRef Name='Title'/><FieldRef Name='FileRef'/><FieldRef Name='Function'/><FieldRef Name='GlobalCountry'/></ViewFields>",
    CAMLRowLimit: "0",
    CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='RecursiveAll'/></QueryOptions>",
    debug: true
    result =;
The problem is that I am able to get only some of the fields (document library use content types) - for example here I get "Function" field returned, but I don't get "GlobalCountry" field. I know the column name is in the right (static) form (I tried to filter the query by this field and it worked). I've also tried:
  • <IncludeMandatoryColumns> => both True and False
  • I verified the "GlobalCountry" field contains data
  • I tried to use the default view and specify only the list name in SPGetListItemsJson function (no ViewFields or QueryOptions), while I made sure that the "GlobalCountry" field is displayed in the default view. It still didn't work => I got back many fields from default view, but not all of them.
I continually checked "this.mapping" in the request result, but "GlobalCountry" column was never specified there.

There is no real difference between "Function" and "GlobalCountry" column and therefore I don't understand how it is possible that I am able to get one column, but not the other one. Please help, I am pretty desperate and I don't know what else to try now - any help is really appreciated.

Thank you,

Jan 13, 2015 at 12:22 PM
Are you sure that "GlobalCountry" is the InternalName of the column? Might it be "Global_x0020_Country" or something?

Jan 13, 2015 at 12:52 PM
Edited Jan 13, 2015 at 1:27 PM
Thank you for such a quick reaction. I am sure that the "GlobalCountry" is the right internal name. I verified it on several places, for example I went into the document library settings, clicked to modify this column and then I checked the URL address => there is ..&Field=GlobalCountry at the end.

I also used SPGetStaticFromDisplay function for the document library and it gave me the same result.

Jan 13, 2015 at 1:38 PM
Do you see "GlobalCountry" in the list schema at the front of the request? (Effectively you get the results of what you'd see in GetLit followed by the data you'd get with GetListItems.) Are you getting values for "GlobalCountry" on some items and not others?

Jan 13, 2015 at 2:18 PM
That's the thing - I don't see it anywhere, not even in the mapping. I can see there 60 various columns, but none of them is ows_GlobalCountry (or anything similar). I've never been able to get this column for any item. Do you think that if I specify my own mapping that it could solve the issue? By the way, is there an easy command to display the original XML file I am getting as a response for my request when using GetListItemsJson?
Jan 13, 2015 at 3:07 PM
Edited Jan 13, 2015 at 3:08 PM
I think I've just found the problem - I displayed the original XML file and I found out that the server gives me back the column, but it's not converted by the GetListItemsJson because it has Name="GlobalCountry" DisplayName="Global Country" and Type="GlobalCountry" (instead of Type="Text"). I bet this is the source of my problems.
Jan 13, 2015 at 4:31 PM
Yes, it probably is. You can create your own mapping to treat that column as a Text column, which ought to work.

You must have created a custom Field Type?

Jan 14, 2015 at 9:46 AM
Eureka, I got it => I defined mappingOverrides as follows:
    mappingOverrides: {
     ows_GlobalCountry: {
      mappedName: "GlobalCountry",
      objectType: "Text"
and it works like a charm.

The problem in my case was that I work with my company's intranet and I have to use globally managed content types that contain custom Field Types (but only in some cases, not always). It makes me a huge headache as there is no real documentation and I need to become a detective sometimes.

Thank you for your advice Marc, I really appreciate it

Marked as answer by xkohj18 on 1/14/2015 at 1:46 AM
Jan 14, 2015 at 1:47 PM
Edited Jan 14, 2015 at 1:47 PM

I just checked the code, and I do indeed exclude any Field Types I don't recognize. I think that makes sense, since unknown Field Types can cause errors that would keep other things from working.

I did just add a note to the docs about this in case it helps others.

Jan 14, 2015 at 1:48 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.