Restrict users to see only their assignment group incidents
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Hello
We have a requirement
1. Logged in User should only see incidents assigned in their assignment group
2.If the user is searching for any incident ticket(ticket is assigned in group which user does not belong to) they should see only Number & Assignment Group fields.
How can we achieve this?
Thanks
Krutika
12 REPLIES 12
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Few more links
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Please check these 2 links.
*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Hi @Krutika Valanj2 ,
Please check the solution below that may help you.
Step 1: Restrict List Visibility (Before Query Business Rule)
A Query Business Rule is used to filter out records at the database level so they never even appear in a user's list unless they meet your criteria.
- Navigate to System Definition > Business Rules and create a New rule.
- Name: Restrict Incident Visibility by Group.
- Table: Incident [incident].
- When: Before.
- Query: Checked.
- Advanced Script :
(function executeRule(current, previous /*null when async*/) {
if (gs.hasRole('admin') || !gs.getSession().isInteractive()) {
return;
}
// Get the logged-in user's groups
var myGroups = gs.getUser().getMyGroups();
current.addQuery('assignment_group', 'IN', myGroups);
})(current, previous); - Step 2: Restrict Field Access for Search Results (ACLs)A Query Business Rule only filters lists. If a user searches for a specific incident number and finds it via Global Search, they might still bypass the rule. To restrict everything except "Number" and "Assignment Group," you must use field-level ACLs.
- Create a Table-Level Read ACL:
- Type: record.
- Operation: read.
- Name: incident.
- Script: answer = true; (This allows general access to the record so it can be found in search).
- Create a Field-Level Read ACL (Restricting all fields):
- Type: record.
- Operation: read.
- Name: incident.* (The asterisk targets all fields).
Script:
var myGroups = gs.getUser().getMyGroups();
answer = myGroups.indexOf(current.assignment_group.toString()) != -1;
- Create Field-Level Read ACLs for Exceptions:
- Create two separate ACLs for the Number and Assignment Group fields.
- Name: incident.number and incident.assignment_group.
- Script: answer = true; (This ensures these two fields are always visible even if the * ACL fails).
- Create a Table-Level Read ACL:
- If you feel this answer helpful for you please mark it as helpful.
Regards,
Sagnic
