Using SP-Pnp-Js Library, I am not able to insert data from a webpart into the sharepoint Tasklist.
private SubmitWorkflowForm(): void {
var TaskNameVal = document.getElementById('taskName')['value'];
var StartDateVal = document.getElementById('startDate')['value'];
var DueDateVal = document.getElementById('dueDate')['value'];
var AssignedToVal = document.getElementById('assignedTo')['value'];
var CompleteVal = document.getElementById('complete')['value'];
var DescriptionVal = document.getElementById('description')['value'];
var PriorityVal = document.getElementById('priority')['value'];
var statusVal = document.getElementById('Status')['value'];
const siteurl: string = this.context.pageContext.site.absoluteUrl + "/_api/web/lists/getbytitle('TestTask')/items";
pnp.sp.web.lists.getByTitle("TestTask").items.add({
Title: TaskNameVal,
StartDate: StartDateVal,
DueDate: DueDateVal,
PercentComplete: CompleteVal,
AssignedTo: AssignedToVal,
Body: DescriptionVal,
Priority: PriorityVal,
Status: statusVal,
}).then(r => {
alert('Success')
$("input").val("")
location.reload();
})
}
In the AssignedTo variable, I am using the "Users Email's value
Error- "value":"A 'PrimitiveValue' node with non-null value was found when trying to read the value of a navigation property; however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected."