How to restrict specific groups or categories of incidents to only its group members and the creator

Muhammed Udhuma
Tera Contributor

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

  1. Create a Before -Query Business rule on 'Incident' table
  2. In the Advanced tab, set the condition as:
    !gs.getUser().isMemberOf('<group name to be restricted for other users>') 
  3. 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

14 REPLIES 14

Peter Bodelier
Giga Sage

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.

 

 

Hi @Peter Bodelier 

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.

Hi @Muhammed Udhuma,

 

Where you able to accomplish your goal?

Hi @Peter Bodelier ,

Yes, completed. I used BR and accomplished my goal.

Thanks for your support.