Enable Edit button on Group member related list for custom role.

Rajeev K1
Tera Expert

Hello,

I have created a custom role ('group_admin') to enable group of members to Add/Remove group members. I modified the Omit Edit Condition (Right Click on List Header bar --> List Layout --> List Control) so only specific role person can access Edit button. 

answer = (!(gs.getUser().hasRole('admin'))) || (!(gs.getUser().hasRole('group_admin')));

As per this script 'admin' role user can able to see Edit button in the group member related list but the button is not visible to the users with 'group_admin'. I have enabled the access from ACLs as well but still its not working.

Please let me know if I missed anything here.

Thanks in advance.

Regards/Rajeev Kumar

1 ACCEPTED SOLUTION

Hi Rajeev,

 

I have tried to replicate your scenario and it worked in my personal development instance. Please modify the 'Omit edit condition' as below and make sure that the 'Omit edit button' checkbox is not selected/checked.

answer = !gs.hasRole('admin') && !gs.hasRole('group_admin');

 

Most importantly, there is an OOB ACL definition which restricts the creation of new Group Membership (sys_user_grmember) record if the user does not have 'user_admin' role. You may refer the below link (please replace with your instance): https://your_instance.service-now.com/sys_security_acl_list.do?sysparm_query=name%3Dsys_user_grmember%5Eoperation%3Dcreate.

 

So, the user must have 'user_admin' role along with 'group_admin' role for the testing purpose. If you wan to modify this condition, you better have to modify the ACL mentioned above.

 

Hope this helps. Please mark the answer Correct/Helpful based on the impact.

Regards,

Amlan

View solution in original post

12 REPLIES 12

sachin_namjoshi
Kilo Patron
Kilo Patron

Please check below for solution 

 

https://www.servicenowguru.com/system-definition/group-managers-manage-group-members/

 

Regards,

Sachin

amlanpal
Kilo Sage

Hi Rajeev,

 

Just modify the script as below and give it a try.

answer = (!(gs.getUser().hasRole('admin'))) && (!(gs.getUser().hasRole('group_admin')));

 

Hope this helps. Please mark the answer Correct/Helpful based on the impact.

Regards,

Amlan

Hi Amlan,

 

Thanks for your reply. I tried as per your suggestion but still no luck. I tried with my custom role only, even that not work for me, here it is

answer = (!(gs.getUser().hasRole('group_admin')));

 

Use below in omit edit condition script

 

var answer = true; //Hide the 'Edit' button by default
if(gs.hasRole('user_admin') || gs.hasRole('group_admin')){
	answer = false; //Show the 'Edit' button if user has 'user_admin' role or is group manager
}

 

Regards,

Sachin