Business Rule Query for Restricting Cases

JW22
Tera Contributor

We have a new requirement where we're onboarding a new group of contractors and we want them to only access a specific number of cases by the case's respective service (which should only be a small handful). I've been exploring ACLs but I think a business rule query is our best option here.

 

I've started on the following where the BR query will check the user's group, and then display cases by the designated workplace service's sys ID:

 

(function executeRule(current, previous /*null when async*/ ) {
var wsd_sysID = '5fe64bd047931e10ae8d9ebd416d432c';
if (gs.getUser().isMemberOf(wsd_sysID)) {
current.addEncodedQuery('workplace_service=2a724129338912506d2802b19e5c7bed');
}
})(current, previous);
 
Unfortunately as we're using our existing case read/write ACLs, all of the cases are still showing (not just the intended cases from the script). Has anyone set-up anything similar for restricting cases using a BR query?
 
Thank you!
1 REPLY 1

Bert_c1
Kilo Patron

The following example works for me:

 

Screenshot 2025-01-27 155416.png

When to run has Query checked and When is "Before".