Restrict the visibility of the incident records with ACL logic or in any other way?

Jerry21
Mega Expert

Hello Community,

We have an assignment group called "#### Computer-Vendor." This has an assignment rule: if a CI is an #### laptop, computer, or printer, the incident will be assigned to the #### computer-Vendor assignment group.
Group members are all from the third-party vendors staff.

I'd like to restrict the incident record so that the "#### Computer-Vendor" member of this group can only see the incident that has been assigned to the group and not other incidents. Currently, they can see every incident record in the table.

In ServiceNow, this group should only see incidents that have been assigned to "#### Computer-Vendor."

I know ACL can do it, but I'm stuck on the logic.

Can anyone help me with ACL logic or in any other way?

 

Thanks in Advance

1 ACCEPTED SOLUTION

suvro
Mega Sage
Mega Sage

You can write a before Query business rule to modify the query to add the following query


var isMember = gs.getUser().isMemberOf('#### Computer-Vendor');

 

if (isMember){

 

current.addQuery('assignment_group.name', '#### Computer-Vendor ');

}

 

View solution in original post

4 REPLIES 4

suvro
Mega Sage
Mega Sage

You can write a before Query business rule to modify the query to add the following query


var isMember = gs.getUser().isMemberOf('#### Computer-Vendor');

 

if (isMember){

 

current.addQuery('assignment_group.name', '#### Computer-Vendor ');

}

 

Hi Suvro, 

Can you please help me a bit here? 

A few members of the group are also members of other assignment groups as well.


When I use these conditions, they are unable to view other incidents that have been assigned to their other assignment group.

 

I need conditions that check if a user is the only member of this group. then it should restrict the visibility. 

 

Thanks in advance

Musab Rasheed
Tera Sage
Tera Sage

Hello,

You can write before query business rule like below

Condition

gs.getUser().isMemberOf('Name of  group') && gs.getSession().isInteractive()

Code:

(function executeRule(current, previous) {
 
	current.addQuery('assignment_group' , 'sys_id of assignment group you want them to see');
	
})(current, previous);

Screenshot

find_real_file.png

Mark my answer as correct if that helps

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Jerry21
Mega Expert

Hi Musab, 

Can you please help me a bit here? 

A few members of the group are also members of other assignment groups as well.


When I use these conditions, they are unable to view other incidents that have been assigned to their other assignment group.

I need conditions that check if a user is the only member of this group. then it should restrict the visibility. 

 

Thanks