Making a user as a group manager for group and giving that user access to add or remove group member

spimple
Tera Contributor

Hello Devs

I am having a requirement where they have stated is that Instead of granting a role we need to do something which will allow group managers to add or remove group members and yes there is manager field in group record 

all i want to do is whatever user i put in that manager field that will be group manager and will be able to add or remove the group members

3 REPLIES 3

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

For this you need to write an ACL on sys_user_grmember so that it only allows creation/deletion of record for that group when the user is the manger of the group.

 

Please follow the below post:-

 

https://www.servicenow.com/community/developer-forum/allow-group-managers-to-add-remove-users-to-gro...

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0753172

 

Please mark my answer as correct based on impact.

spimple
Tera Contributor

Can you please tell me if it needs a script ? Could you pls explain the steps ?

Hello,

 

if you check the above post you will get the script but pasting the code directly here:-

 

Create Delete and Write ACL on table level (ā€˜sys_user_grmember’) 

check advanced 

in script write below

 

if(typeof parent != 'undefined' && parent.manager == gs.getUserID()){
   answer = true; //Allow access if user has 'user_admin' role or is group manager
}else{

answer = false;

}

 

Please mark my answer as correct based on Impact.