We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

User Query OOB BR

oww15
Tera Contributor

Hi everyone! Do you have an idea on how I can except this OOB BR to not run on a specific catalog item? Please see my script below, I've tried to modify it but it doesn't work

 

var checkItem = gs.getProperty("CatalogItem");
var checkVar = gs.action.getGlideURI().toString().indexOf('66d528fb1b7cf1503620b6c5464bcbc7');
 
if (checkVar == -1) {
    current.addActiveQuery();
}
 
My sys property below
 
Name: CatalogItem
Type: String
Value: 66d528fb1b7cf1503620b6c5464bcbc7
 
Thanks!
 
2 REPLIES 2

Anurag Tripathi
Mega Patron

Hi,

Check this,

Similar question is answered here.

Solved: Bypass query business rule for catalog variable - ServiceNow Community

 

-Anurag

Yashsvi
Kilo Sage

Hi @oww15,

please check below BR:

var query = current.getEncodedQuery();

if (gs.getSession().isInteractive() && !query.includes('activeANYTHING')) {
    current.addActiveQuery();
}

Thank you, please make helpful if you accept the solution.