Restricting access to incidents of multiple assignment groups

JamesLindsay
Giga Guru

I am looking at https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790987 and trying to manipulate it in a way to solve my issue. I have members of all other assignment groups taking incidents (re-assigning) from my 7 assignment groups. The only people I want to be able to affect the incidents in those 7 assignment groups are the members of the 7 assignment groups. The solution works well for a single assignment group. The only deviation I have made is to the condition of the business rule. !gs.hasRole("admin") || !gs.hasRole("noc_user")

I added the role "noc_user" and assigned the new role to the 7 groups I own. I thought I could somehow loop through an array of the 7 assignment groups but, I'm not clear on what needs to be returned so that anyone who is a member of the 7 groups will see the incidents and no one else will unless the incidents are no longer in one of the 7.

I don't know that I fully understand what needs to be returned here and in the case of multiple groups how to meet that need.

(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);




2 REPLIES 2

AndersBGS
Tera Patron
Tera Patron

Hi @JamesLindsay ,

 

Instead of the above custom script that you're doing, you should look at the data filtration rule plugin which comes OOTB. This will do exactly what you're looking for.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders 

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/

AnimeshP_96
Tera Guru

@JamesLindsay 
i didnt clearly understood but i think apply reference qualifier to the field and use condition as "sys ID is not on of " capture all sys id from the group table, so that it wont show up in the field search


Please accept the solution /mark this response as correct or helpful if it assisted you with your question.




Regards,
Animesh