Records Visibility

David Boom
Tera Contributor

As a user, I want to only see incidents that are assigned to my group. So that I cannot see tickets assigned to other group. How to achieve this?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@David Boom 

you can use query business rule on your table, get the groups to which logged in user belongs and then apply the query

Something like this

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var groups = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());
	current.addQuery('assignment_group','IN', groups.toString());

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @David Boom 

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0790987

 

https://www.servicenow.com/community/sysadmin-forum/creating-user-group-with-restricted-access-to-in...

 

https://www.servicenow.com/community/developer-forum/how-can-i-limit-an-assignment-group-to-view-onl...

 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Ankur Bawiskar
Tera Patron
Tera Patron

@David Boom 

you can use query business rule on your table, get the groups to which logged in user belongs and then apply the query

Something like this

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var groups = new global.ArrayUtil().convertArray(gs.getUser().getMyGroups());
	current.addQuery('assignment_group','IN', groups.toString());

})(current, previous);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Can we do this with Query ACL's?

@Ankur Bawiskar How can i restrict this BR to trigger for certain roles only?