0

I have been searching the Internet for a solution, but from what I can tell, I am doing everything correctly. I have a List that has a lot of Lookup Fields. I specify all of the fields I want to come back but the only ones that don't are the Lookup Fields even though I know some of them have values. Is there something else I'm missing?

If it matters, my SPServices version is 0.7.2 and I'm on SharePoint 2010.

var query = "<Query> \
    <Where><Eq><FieldRef Name='ID' /><Value Type='Text'>" + ItemID + "</Value></Eq></Where> \
</Query>";

var listFields = "<ViewFields> \
    <FieldRef Name='Version' /> \
    <FieldRef Name='Function ID' /> \
    <FieldRef Name='Function Name' /> \
    <FieldRef Name='Function Description' /> \
    <FieldRef Name='GovernanceDescription' /> \
    <FieldRef Name='Governance Documentation' /> \
    <FieldRef Name='Compliance Register Items' /> \
    <FieldRef Name='Execute BU 1' /> \
    <FieldRef Name='Execute BU 2' /> \
    <FieldRef Name='Execute BU 3' /> \
    <FieldRef Name='Execute BU 4' /> \
    <FieldRef Name='Execute BU 5' /> \
    <FieldRef Name='Execute BU 6' /> \
    <FieldRef Name='Execute BU 7' /> \
    <FieldRef Name='Execute BU 8' /> \
    <FieldRef Name='Execute BU 9' /> \
    <FieldRef Name='Execute BU 10' /> \
    <FieldRef Name='ExecuteDescription1' /> \
    <FieldRef Name='ExecuteDescription2' /> \
    <FieldRef Name='ExecuteDescription3' /> \
    <FieldRef Name='ExecuteDescription4' /> \
    <FieldRef Name='ExecuteDescription5' /> \
    <FieldRef Name='ExecuteDescription6' /> \
    <FieldRef Name='ExecuteDescription7' /> \
    <FieldRef Name='ExecuteDescription8' /> \
    <FieldRef Name='ExecuteDescription9' /> \
    <FieldRef Name='ExecuteDescription10' /> \
    <FieldRef Name='Oversight BU 1' /> \
    <FieldRef Name='Oversight BU 2' /> \
    <FieldRef Name='Oversight BU 3' /> \
    <FieldRef Name='Oversight BU 4' /> \
    <FieldRef Name='Oversight BU 5' /> \
    <FieldRef Name='Oversight BU 6' /> \
    <FieldRef Name='Oversight BU 7' /> \
    <FieldRef Name='Oversight BU 8' /> \
    <FieldRef Name='Oversight BU 9' /> \
    <FieldRef Name='Oversight BU 10' /> \
    <FieldRef Name='OversightDescription1' /> \
    <FieldRef Name='OversightDescription2' /> \
    <FieldRef Name='OversightDescription3' /> \
    <FieldRef Name='OversightDescription4' /> \
    <FieldRef Name='OversightDescription5' /> \
    <FieldRef Name='OversightDescription6' /> \
    <FieldRef Name='OversightDescription7' /> \
    <FieldRef Name='OversightDescription8' /> \
    <FieldRef Name='OversightDescription9' /> \
    <FieldRef Name='OversightDescription10' /> \
    <FieldRef Name='Support_BU_1' /> \
    <FieldRef Name='Support BU 2' /> \
    <FieldRef Name='Support BU 3' /> \
    <FieldRef Name='Support BU 4' /> \
    <FieldRef Name='Support BU 5' /> \
    <FieldRef Name='Support BU 6' /> \
    <FieldRef Name='Support BU 7' /> \
    <FieldRef Name='Support BU 8' /> \
    <FieldRef Name='Support BU 9' /> \
    <FieldRef Name='Support BU 10' /> \
    <FieldRef Name='SupportDescription1' /> \
    <FieldRef Name='SupportDescription2' /> \
    <FieldRef Name='SupportDescription3' /> \
    <FieldRef Name='SupportDescription4' /> \
    <FieldRef Name='SupportDescription5' /> \
    <FieldRef Name='SupportDescription6' /> \
    <FieldRef Name='SupportDescription7' /> \
    <FieldRef Name='SupportDescription8' /> \
    <FieldRef Name='SupportDescription9' /> \
    <FieldRef Name='SupportDescription10' /> \
</ViewFields>";

$().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "GOES Functions",
    CAMLQuery: query,
    CAMLViewFields: listFields,
    completefunc: function (data, status) {
        if (status == "success") {
            var json = XMLItemToJSON($(data.responseXML).SPFilterNode("z:row")[0]);

        } else if (status == "error") {
            alert("Fail");
        }
    }
});
  • Do you get all your fields back if you use this: CAMLViewFields: "<ViewFields Properties='True' />" – Erin L Nov 3 '16 at 22:27
  • It looks like you're not using the internal names. For example, the internal name for Execute BU 10 is probably Execute_x0020_BU_x002010 Do you know how to get internal names? – Erin L Nov 3 '16 at 22:29
  • Oh. Uggh. I feel stupid now. Lol. I will try that tomorrow. I think that will be the problem. – Robert Burke Nov 3 '16 at 22:31
2

Use the internal name: Execute_x0020_BU_x002010 instead of Execute BU 10

0

After doing the suggestion by Erin L above, I was able to get my code working. I should have been totally aware of this, but it slipped my mind.

Be sure your field names are "encoded" properly and not the display value for that field.

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.