Before Query business rule not running as expected

PavelP
Mega Sage

Hello,

after recent Tokyo Patch, our customer started getting an unexpected behavior related to their Before-Query Business Rule.

In the rule, they are using the QR and QC for querying separately table and record. After the patch however, it seems the query is running together with AND condition in between - and it severely limit the results.

Is there a new behavior? Is there option to revert it so the original behavior remains?
Thanks

Best regards

Pavel

3 REPLIES 3

RaghavSh
Kilo Patron

What is the query?

The limitation could be due to any OOB ACL changes, check the ACL. There doesnt seems to be any functionality change in Before query BR.


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023

Im not aware about any ACL change. What surprised me was that retrieving the Query for Business Rule had both of the queries (for qc and qr) together with AND parameter, which I don't think should have been the case.

The code is quite exensive but for simplicity here are few examples (ignore missing variables):

 

function applyQuery(generic) {
var qc;
var qr;

 

if (!gs.hasRole('u_app_domain_supervisor')) {
qr = current.addNullQuery('u_appdomain');
qr.addOrCondition('u_service_recipient', u).addOrCondition('opened_by', u).addOrCondition('caller_id', u).addOrCondition('watch_list', 'CONTAINS', u).addOrCondition('u_owned_by', 'DYNAMIC', 'd6435e965f510100a9ad2572f2b47744').addOrCondition('assignment_group', 'IN', user_groups.toString());
}

if (!isGISMember(user_groups.toString()) && !gs.hasRole('u_app_domain_supervisor')) {
qc = current.addQuery('u_service_recipient', u).addOrCondition('opened_by', u).addOrCondition('caller_id', u).addOrCondition('watch_list', 'CONTAINS', u).addOrCondition('u_owned_by', 'DYNAMIC', 'd6435e965f510100a9ad2572f2b47744');

}

 

 

Now for this example, the records fulfilling condition with assignment_group field would not be fulfilled, despite the condition matching the QC variable. Is that expected behavior? I believe it worked as it being visible before the update.

 

Ankur Bawiskar
Tera Patron
Tera Patron

@PavelP 

Did you debug the BR and check where it logs?

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