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!!!
The 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
});