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

@David Boom 

you can use table level READ ACL as well for this with similar condition

Also if you want this BR to run only for specific role then use this in the BR condition

gs.hasRole('roleABC')

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