1

I'm trying to add to a checkbox field in my company's 2013 Sharepoint install. I'm using javascript as I've built a Chrome Extension to do some work hitting several sites and compiling information, then putting it in Sharepoint.

I'm getting stuck on how to add to a field "SPFieldMultiChoice". Here's what the data looks like, and I've tried all types of things with no success:

var data = JSON.stringify({
    ... other fields ...
    'Divisional' : 'Yes'});

Here's the error I get: An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected

I understand this to mean that I need to make it in object, like this:

    'Divisional' : {'Yes'}

But that doesn't work either because obviously it needs a key name to go with the value... but what?

I've also tried:

    'Divisional' : ['Yes']

Earlier, I had the URL problem described here: REST POST: How to add a list item with 'people and group', 'choice,' and 'URL' fields? but that is fixed for me. I tried to do the same type of thing, by making it an array or object or array of objects, but I don't know what properties (like, in the case of the URL: Description & Url) to set.

1 Answer 1

1

Woohoo! After more searching and some trial and error, I figured it out:

'Divisional' : {'results' : ['Yes']}

I'm guessing since the value is a javascript array, it can take several options, maybe like this:

'Divisional' : {'results' : ['Yes','Of Course','Like, totally','Yup']}

Hope that helps cut a few hours of your next interaction with SP and leave a few hairs, if you still have any.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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