UpdateListItems with Multi-select Lookup

Aug 15, 2011 at 11:44 PM

There have been a few discussion on the topic of setting lookups and fields with multiple values using the batch commands but I have a slightly different error.

I have a multi-select lookup column and no matter how I parse the value and text of the lookup, the xmlresponse would have a '0x00000000' error code, but a blank value for the Lookup column (thus, not setting the column).

While debugging, I changed the column to a single selection Lookup and the xmlresponse would have everything up to the first ':#' delimiter as the new value, but the list item still does not have a value in the lookup column.

Has anyone come up against this issue before?

Coordinator
Aug 15, 2011 at 11:49 PM
Is that ":#"? If so, it needs to be ";#". Assuming that's just a typo, can you post the code you ae having trouble with?

M.
>
Aug 16, 2011 at 12:07 AM
Edited Aug 16, 2011 at 4:43 AM

Yup, definitely a typo.

 

 

$().SPServices({
        operation: "UpdateListItems",
        async: false,
        batchCmd: "New",
        listName: listName,
        listURL: listURL,
        valuepairs: [["Title", titletext], ["Answer", answerText], ["Multiselect_x0020_Lookup_x0020_Field", lookupVal]],
        completefunc: function(xData, Status) {
        	alert(xData.responseXML.xml);
        }
    });

 

 

I've tried setting lookupVal to "1;#Title" (as a single option lookup) as well as "1;#Title;#2;#Title" and "1;#;#2" (multi-select)

 

For the first scenario, the response is <z:row... Multiselect_x0020_Lookup_x0020_Field="1;#" ...> regardless of how many values are passed (which makes sense), when set to a multi-select, the resonse is <z:row... Multiselect_x0020_Lookup_x0020_Field="" ...> with no error.

Aug 16, 2011 at 12:08 AM

(but the Lookup column of the new item is always empty)

Coordinator
Aug 17, 2011 at 1:27 PM
Edited Aug 17, 2011 at 1:27 PM

mrSPARQLE:

Take a look at my blog post and see if it helps.

M.

Aug 17, 2011 at 10:26 PM

Thanks, Marc. The bit on 'nulling out' values was an eye opener.