Get Current SP Catalog Item on sys_user business rule

Nsovo
Tera Contributor

On the 'user query' business rule, we would like to amend the Condition to check/get where the query is being executed.

 

So, we would like the business rule not to run when it's being queried from a specific Catalog Item, i.e gs.getCurrentCatalogItem!=[sys_id/name]. 

 

We have not found any GlideSystem function that can achieve this for us. Please assist.

 

 

8 REPLIES 8

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
Do you want to change the query BR for a specific catalog ?



Thanks and Regards,

Saurabh Gupta

Nsovo
Tera Contributor

Correct - we do not want it to run on a specific catalog item.

Hi,
This can be achieved using the "getEncodedQuery" method of GlideRecord.

Sample code-

var query = current.getEncodedQuery();
if(!query.includes('u_catalog!=sys_id'))//You can choose the query of your choice on user table
{
    current.addQuery("active"true);
}

Thanks and Regards,

Saurabh Gupta

Hi. I I tried this solution but it did not work. I also amended it as below, it also did not work:

var query = current.getEncodedQuery();

if (query.includes('u_catalog!=3af32f1a1b3079d82d421022b24bcbf4')) {
current.addActiveQuery();
}