Here is my ajax code to set multi choice field:
$.ajax({
url: fullUrl,
method: "POST",
data: JSON.stringify({
'__metadata': { 'type': 'SP.Data.AuditItem' },
'Register': that.register,
'RiskRegister': that.nextIndex,
'Reopen': that.formatDate(that.reopen),
'RiskOrIssue': that.riskOrIssue,
'Locations': that.locations, //<---multi-select choice field
'ProblemT': that.probTitle,
'ProblemStatement': that.problemStatement,
'TaskOwner': that.taskOwner,
'RiskOwner': that.riskOwner,
'Auditor': that.auditor //<--- multi-select choice field
}),
headers: {"accept": "application/json;odata=verbose","content-type": "application/json;odata=verbose","X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: function(){
alert("Item Added!");
},
error: function(data){
console.log(data);
}
}); For multi choice field, happen the error below, please help me how to solve:
"value: "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."
Thanks in advance