In my spfx webpart, I'm creating list item using pnp js. As per pnp-core-js documentation I have written following code, but its failing with error.
Private AddListItem()
{
pnp.sp.web.lists.getByTitle('EmployeeList').items.add({
JobTitle : this.state.var_JobTitle,
JobDescription :this.state.var_JobDescription,
Salary:this.state.var_Salary,
Age:this.state.var_Age,
LocationId:this.state.var_Location.key,
Technology:this.state.var_Technology.key,
Passport:this.state.var_Passport,
ManagerId:{results:[15,29]}
}).then((iar:pnp.ItemAddResult)=> {
console.log(iar);
});
}
Error:
Error: Error making HttpClient request in queryable [400] ::> {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException","message":{"lang":"en-US","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."}}}
NOTE: If I comment that line (ManagerId) then code works fine.