Get Current SP Catalog Item on sys_user business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 12:29 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 09:34 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2023 01:20 AM
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>'
I HOPE THIS HELPS
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 04:58 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 10:19 PM
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();
}
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates