I want to add list item with multiple people picker column, how can add multiple users in my list column?
I can successfully add single people picker item, but not multiple. My code is working fine with adding single people picker item.
My code:
var ctx = new SP.ClientContext(appWebUrl);
var appCtxSite = new SP.AppContextSite(ctx, spHostUrl);
var web = appCtxSite.get_web();
var list = web.get_lists().getByTitle("GNPages");
var listCreationInformation = new SP.ListItemCreationInformation();
var listItem = list.addItem(listCreationInformation);
var processContri = new Array();
angular.forEach(ppMultiVal, function (value, key) {
console.log(value.name);
processContri.push(SP.FieldUserValue.fromUser(value.name));
});
listItem.set_item("Title", title);
listItem.set_item("Description", descr);
listItem.set_item("ProcessOwner", ppSingleVal.Id);
listItem.set_item("ProcessContributer", processContri);
listItem.update();
ctx.load(listItem);
//Execute the batch Asynchronously
ctx.executeQueryAsync(
Function.createDelegate(this, success),
Function.createDelegate(this, error)
);