Compare User Information on ACL against Records for Read Access
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 08:40 AM
Hello, I have users in 4 regions who all have "read" access to the table. They are requesting we lock read access down by location. Im struggling on the script I would write to look up users location "user.location" and if it matches current.fieldname.location then allow read.
Any guidance would be appreciated!
Nic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 08:48 AM - edited 10-24-2023 08:50 AM
Hi @Nic Omaha ,
U can try something like this
if(current.fieldname.location == gs.getUser().getLocation()){
answer = true;
}else{
answer= false;
}
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 08:52 AM
Hello @Nic Omaha
Use belo script
answer = checkUser();
function checkUser(){
var usr = gs.getUserID();
var groups = new GlideRecord('sys_user');
groups.addQuery('sys_id='+usr);
groups.query();
if(groups.next()){
if(groups.location=='your_location_name'){
return true;
}
else {
return false;
}
}
Please accept solution and mark as helpful, if it resolves your query.
Thanks