adding user in sys_user_grmember table from BR

Hafsa1
Mega Sage
I'm using simple BR on HR task table to insert user in groups. But it in not working. When I'm running this via admin, it is working, but when with other user then it is not adding user to group. Anything I'm missing?
 
var grp = current.groups.toString(); //Group to execute action against
    var grps = grp.split(',');
    var subject = current.opened_by; //Get User to execute action against
  for (var i = 0; i < grps.length; i++) {
        var grMbr = new GlideRecord('sys_user_grmember'); //Initiate Glide against Group membership table
        //Add Group membership  
        grMbr.initialize();
        grMbr.user = subject;
        grMbr.group = grps[i];
        grMbr.insert();
    }
2 REPLIES 2

Vrushali  Kolte
Mega Sage

 

Hello @Hafsa1 ,

 

The issue you're encountering is likely due to the fact that the non-admin users do not have the necessary permissions to perform the insert action on the sys_user_grmember table. You can check the role or you can check and adjust ACLs (write/create) to ensure that the required permissions are in place for users to perform actions on the sys_user_grmember table.

 

For more information on ACL please refer below doc -

 

https://docs.servicenow.com/bundle/washingtondc-platform-security/page/administer/contextual-securit...

 

https://www.basicoservicenowlearning.in/2021/08/acl-in-servicenow.html

 

If my answer solves your issue, please mark it as Accepted ✔️& Helpful👍!

 

 

Hafsa1
Mega Sage

but which role is responsible to add user to group?