Can anyone please advise: we are using REST to create list items and have done several of these. This is the first time we are attempting to create a list item with a Person or Group field that allows multiple names. I understand the field expects Collection(Edm.Int32) so we created an object with the IDs of all the users. Passing this in, however, continues to give us the error:
A node of type 'StartArray' was read from the JSON reader when trying to read a value of a property; however, a 'PrimitiveValue' or 'StartObject' node was expected.
Our jQuery function that creates is below. We use the same one for forms with single Person fields without issue.
function createSPListItem(url, listName, itemFlds, success, failure) {
try {
var postURL = url + "/_api/web/lists/getbytitle('" + listName + "')/items";
$.ajax({
url: postURL,
type: "POST",
contentType: "application/json;odata=verbose",
data: JSON.stringify(itemFlds),
headers: {"Accept": "application/json;odata=verbose","X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function (data) {
success(data);
},
error: function (data) {
failure(data);
}
});
} catch (err) {
formError(arguments.callee, err.toString());
}
}Our Payload looks like:
{"__metadata":{"type":"SP.Data.OurListItem"},"RequestorId": [106,111],"Title":"pn","Phone_x0020_Extension":"25283","DirectorId":1,"Project_x0020_Details":"pn","ContinueWith":"i","CompleteDate":"03/09/2016","AssignedToId":null,"Phase":"New","Status":"Green"}
- Thank you. Respectfully, Janette M. Ricker