I have a newrequest.aspx page in a Sharepoint 2013 App with a form on it to get details from my users to submit a leave request,this is then submitted to a Sharepoint list to hold all of the requests for a workflow. On this form I have created a peoplepicker using the following code:
Then in my .js file I have the following code to retrieve the values from that peoplepicker :
var managerTitle = $("#manager_TopSpan_ResolvedList").find("span.ms-entity-resolved").attr("title");
var oList = context.get_web().get_lists().getByTitle("Leave Requests"); var itemCreateInfo = new SP.ListItemCreationInformation(); this.oListItem = oList.addItem(itemCreateInfo); oListItem.set_item("Manager", managerTitle); oListItem.update(); context.load(oListItem); context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
The manager field chosen above is also a peoplepicker. I am looking for assistance to set that value. The code above gives an error by saying
Invalid data was used to update the field or the field may be read-only
I have googled and tried a lot of different recommendations to no avail. Any assistance will be appreciated.