
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 06:03 AM
Hello,
I need is to create ACL where user can see only tickets assigned to the group he is member of. I have 3 groups (Eastdpt), (Westdpt) and (National). Currently all groups have access to each other's tickets. I need ACL that allow (National) to see both Region’s tickets, (westdpt) to see the West Region’s tickets and (eastdpt) to see the East Region’s ticket. It’s a custom table and has one role. The sys user role is x_acc_region_.acc_user
Eastdpt and Westdpt are assignment group but National is a security group
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 06:30 AM
Hello @sparkles,
Here is an example of how such an ACL might look like:
- Name: x_acc_region_table.read
- Type: Record
- Operation: Read
- Table: x_acc_region_table
- Script:
// Get the current user's groups
var userGroups = gs.getUser().getMyGroups();
// Create a GlideRecord object for the x_acc_region_table
var gr = new GlideRecord('x_acc_region_table');
// Add a query to filter records by assignment group
gr.addQuery('assignment_group', 'IN', userGroups);
// Execute the query
gr.query();
// Check if any records match the query
if (gr.hasNext()) {
// Return true to allow access
return true;
}
// Return false to deny access
return false;
Hope this helps.
Kind Regards,
Swarnadeep Nandy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 06:35 AM
Hi @sparkles
You should try Query BR for this use case and not the ACL, it will not be good for user experience as you will find empty rows in the list layout.
Best approach would be combo or Query BR and ACL.
Aman Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 06:30 AM
Hello @sparkles,
Here is an example of how such an ACL might look like:
- Name: x_acc_region_table.read
- Type: Record
- Operation: Read
- Table: x_acc_region_table
- Script:
// Get the current user's groups
var userGroups = gs.getUser().getMyGroups();
// Create a GlideRecord object for the x_acc_region_table
var gr = new GlideRecord('x_acc_region_table');
// Add a query to filter records by assignment group
gr.addQuery('assignment_group', 'IN', userGroups);
// Execute the query
gr.query();
// Check if any records match the query
if (gr.hasNext()) {
// Return true to allow access
return true;
}
// Return false to deny access
return false;
Hope this helps.
Kind Regards,
Swarnadeep Nandy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 06:35 AM
Hi @sparkles
You should try Query BR for this use case and not the ACL, it will not be good for user experience as you will find empty rows in the list layout.
Best approach would be combo or Query BR and ACL.
Aman Kumar