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

Hi,
This will not work until, u_catalog is a field on user table and this query should be written in the reference qualifier of the catalog variable where you want to apply the query BR.

 

 


Thanks and Regards,

Saurabh Gupta

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Nsovo,

 

In the business rule you have a field called ''condition'' in Advance tab. There you can configure the condition to run or no run for specific catalog item based on sys_id .

 

current.cat_item == '<sysIdOfCatalogItem>' 

OR

current.cat_item != '<sysIdOfCatalogItem>'

 

SohailKhilji_0-1693901938409.png

 

I HOPE THIS HELPS

 

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi Sohail, doesn't seem to work.

I want to check this from the 'user query' business rule, which is running against the sys_user table.

Vishal Birajdar
Giga Sage

Hello @Nsovo ,

 

you need to put "setWorkflow(false)" form where you are querying it.

This will stop execution of business rule when queried. 

 

e.g, if in your script you are glide recording on sys_user table

var grUser = new GlideRecord("sys_user");
grUser.addQuery('active',true);

grUser.query();
if(grUser.next()){
   //do your job
grUser.setWorkflow(false);
grUser.update();
}
 
 
 
 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates