I found many articles on how to add user in Person or Group column using JSOM, but i couldn't find any article which shows how to add SharePoint group in Person or Group column using JSOM.
Could someone help me in this!!!
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityThe following example demonstrates how to set Group as a field value via SharePoint JSOM API.
Lets assume group
variable represents SP.Group
object which has been retrieved from the server, then list item user field value for a SharePoint Group could be set like this:
let groupVal = new SP.FieldUserValue();
groupVal.set_lookupId(group.get_id());
listItem.set_item(userFieldName, groupVal);
listItem.update();
ctx.executeQueryAsync(() => {
//...
}, (sender, args) => {
//handle error
});