How to restrict specific groups or categories of incidents to only its group members and the creator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 01:22 PM
I want to restrict some groups of Incidents to only its group members and the incident creators. I have found the below KB and it is working only for the group members, but the incident creator is unable to see the created incident. I have tried adding addOrCondition for the sys_creator_by, but it is not working. Please share some ideas to achieve this.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790987
Steps to Perform
- Create a Before -Query Business rule on 'Incident' table
- In the Advanced tab, set the condition as:
!gs.getUser().isMemberOf('<group name to be restricted for other users>') - In the script field, update sys_id of the group to be restricted
(function executeRule(current, previous /*null when async*/ ) {
var grp = current.addNullQuery('assignment_group').addOrCondition('assignment_group','!=','<sys_id of the group to be restricted for other users>');
})(current, previous);
This Before-Query Business rules restrict the incidents assigned to the specific group visible only to those group members
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2023 01:37 PM
Hi @Muhammed Udhuma,
I would personally suggest to use ACL's or Data Filtration to accomplish your goal, since Query Business rules are less visible when something is not working/showing.
It's also not really possible to do this is a nice way with a Query Business Rule.
You could add to the condition that opened_by is current user, but this would mean that everyone not in the assignmen group would always query for incidents opened by themselves, unless they query that out specifically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2023 08:53 AM
Thanks for your quick support on this. I will check the ACL's or try to do some modifications in the BR conditions to achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2023 11:56 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 09:54 PM