How to write business rule to restrict the visibility access to records for users depending on the groups and roles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2021 06:05 AM
Hello,
I'm working on the VR items and I want to write the BR for the records to restrict the access of visibility for the records that are groups based on users and groups.
For eg: records only visible tot he users having access to specific group.
Any leads on this?
- Labels:
-
Vulnerability Response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2021 06:27 AM
Hi,
you can use query business rule on that table.
But does your table have some group field etc
BR: Query - True
Condition: gs.getSession().isInteractive()
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(gs.getUser().isMemberOf("Group ABC"))
current.addQuery('group', 'GROUP ABC');
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2021 06:56 AM
I have couple of groups, then?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2021 07:06 AM
Hi,
you need to write those many if else statements in above script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 07:21 AM
If else conditions are not working. I have also trid with multiple seperate query BR on same table as if else was not working, still no luck.