ACL for a particular field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 04:12 AM
Hi
need your help to implement an ACL with the logic as -
I have created a new field " xyz" with a checkbox on a particular form using type true/false. My form is having three fields as support manager, responsible manager and a support group.
Now the requirement here is the newly created field with the checkbox can be checked or unchecked only by the support manager , responsible manger or any member of that support group that a form is having. For other users it should be a read only field..
pls help how can I proceed with this. I know we can do via write ACL but help with the script and logic for the reference.
Thanks
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 04:24 AM
Hi,
You can use the below logic.
- Create a role for the users how can have access to that field.
- Assign the roles to the related users (ex. support manager)
- Configure the ACL as
for read and write both
Tablename.fieldname (here field is "xyz")
add the role (which has created above) in this ACL
Note : The users should to have the table level access.
Mark this as Correct/Helpful in case this helps you in anyways.
Regards,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 04:25 AM
Hi,
You can implement a Write ACl on Incident table at the field level with the below script as:
1)ACL Type :- Write Acl
2)Condition :- Table Name. Field Name
3)Role:- if any role is mandatory
4)Code snippet
if(gs.getUser().isMemberOf('SupportGroupName')) {
answer = true;
}
else{
answer = false;
}
Hope this helps. Mark the answer as correct/helpful based on impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 04:26 AM
Hello Utkarsh,
Pleas use the below script on your write ACL for table.fieldname
answer = checkbox();
function checkbox() {
var user=gs.getUserID();
var grp=current.support group;
if(gs.getUser().isMemberOf(current.support group) || current.responsible_manager==user || current.support_manager == user) {
return true;
}else{
return false;
}
}
Please mark answer correct/helpful based on impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 04:29 AM
Hi,
So you can have field level WRITE ACL on that field for your table
Advanced - True
Script
answer = gs.getUser().isMemberOf(current.support_group) || current.responsible_manager == gs.getUserID() || current.support_manager == gs.getUserID();
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
