Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Restrict access to table based on group

Akshaya14
Tera Contributor

Hi Team, 

I want to restrict the user with in the "manager group" which contains the roles "sn_wsd_manger" and "sn_wsd_rsv_case_reader" to create  the new  "workplace service"  but they can should able to create the new "workplace service item" which is available in related list.

Akshaya14_0-1695796259788.png

 

3 REPLIES 3

Harish KM
Kilo Patron

You would need to edit the existing create ACL on this table and add the below line in advanced script of ACL

if(gs.hasRole('role_name')||gs.hasRole('role_name'))
        answer = true;
    else
        answer = false;
Regards
Harish

Sandeep Rajput
Tera Patron

@Akshaya14 You need two Create ACL.

 

1. Create ACL on Workplace Service Table, this will be a scripted ACL where you can check

if(!gs.getUser().isMemberOf('manager group')){
answer = true;
}
else{
answer=false;
}

2. Second Create ACL should be defined on Workplace Service Items table as follows.

if(gs.getUser().isMemberOf('manager group')){
answer = true;
}
else{
answer=false;
}

Anand Kumar P
Tera Patron

Hi @Akshaya14 ,
Create acl on workplace servicetable with below script.

 

if (!gs.hasRole('sn_wsd_manager') && !gs.hasRole('sn_wsd_rsv_case_reader') && gs.getUser().isMemberOf('manager_group')) {
    answer = true;
} else {
    answer = false;
}

 

 

 Create acl on workplace service item table with below script.

 

if(gs.getUser().isMemberOf('manager group')){
answer = true;
}
else{
answer=false;
}

 

If it works, please mark it as helpful.

Thanks,

Anand