- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 11:35 AM
We have a section of our IT staff that have access to some areas of SN but not others. This spans various groups, but we have created a custom flag of u_ecr.
on a table, I am trying to restrict read rights to memebers who have u_ecr as false. If u_ecr is true, you should be denied access to view this table.
I thought this would be a simple script of :
if(gs.getUser().getRecord().getValue('u_ecr') == 0){
answer = true;
}
But when this script is in place, no one can view the table. I had even tried adding an else for the answer = false. Still same outcome. in xplore, I have run this code to test the outcome of gs.getUser().getRecord().getValue('u_ecr'), and it returns the proper 1 or 0 depending on the user. Am I writing the ACL condition script incorrecty? If I set it to just plain aswer = true; it works fine.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 11:48 AM - edited 10-24-2024 11:48 AM
Try this
var grSysUser = new GlideRecord('sys_user');
if (grSysUser.get(gs.getUserID() )) {
if(grSysUser.u_ecr == 'false') //modify value according to req
answer = true;
}
Refer below KB Article
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0723759
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2024 11:48 AM - edited 10-24-2024 11:48 AM
Try this
var grSysUser = new GlideRecord('sys_user');
if (grSysUser.get(gs.getUserID() )) {
if(grSysUser.u_ecr == 'false') //modify value according to req
answer = true;
}
Refer below KB Article
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0723759
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2024 06:54 AM
only a slight modification needed for this to work. Seems it prefers 1/0 over true/false. This worked as a final cut of the code:
var grSysUser = new GlideRecord('sys_user');
if (grSysUser.get(gs.getUserID() )) {
if(grSysUser.u_ecr == 0) //modify value according to req
answer = true;
}
Thanks!