Restricting Access to Incident Records based on Role and Business Service
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I have a requirement to restrict access to particular incident records based on Role and Business service.
The incidents created from "Payroll Issues" record producer must be visible only for the users having Role- ( payroll + itil ) and having Business service as "Payroll Issues".
And the " itil " role users must not be able to see this record in incident record list and it must be restricted.
But the below code in ACL isn't working as per requirement. Can someone guide me where I need to correct. Thanks in advance.
Incident Read ACL:
Script:
(function() {
var salaryBS = '27d3f35cc0a8000b001df42d019a418f'; //sys_id of "payroll issues" Business service
if (current.business_service != salaryBS) {
return gs.hasRole('itil');
}
if (current.business_service == salaryBS) {
return gs.hasRole('itil') && gs.hasRole('payroll_issue');
}
return false;
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar,
It's not working as expected. The above BR is hiding all the incident records for itil role users, irrespective of Business Service. For users having payroll role - incidents generated from "Payroll issues" record producer only must be visible. And for itil role user's incidents generated from "Payroll issue" record producer should not be visible.
Thankyou.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
so what debugging did you do and what script you enhanced?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @RakshithaM ,
Have you looked into data security filters instead: https://www.servicenow.com/docs/bundle/yokohama-platform-security/page/administer/security/concept/s...
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @RakshithaM , Did my solution help if not then is your requirement fulfilled, Please let me know how?
Regards,
Saurabh V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago