Announcing the Global SNUG Board of Directors. Learn more here

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tiagomacul
Mega Sage
Mega Sage

How to Bypass query business rule for catalog variable

 

ImageDescription
image01. ServiceNow Login
image02. >> System Definition > Business Rules
image03. New
image

04. Type name, for example

 

"set Short Description App grp"

find_real_file.png05. Select Group approval table sys_user
image06. on the "When to run" tab, select before
find_real_file.png07. select "query"
image08. Select Advanced
find_real_file.png

09.Condition

 gs.getSession().isInteractive()

 

 find_real_file.png

10. Script

current.addActiveQuery();

 

11. Click Save/update

 

OK, it's the procedure to restrict BUT How to Control record access inserting an exception?

A. CONDITION ADMIN Role

find_real_file.png

09.Condition

 gs.getSession().isInteractive() && !gs.hasRole("admin")

 

B. CONDITION ADMIN Role

find_real_file.png

09.Condition

 gs.getSession().isInteractive() && !gs.hasRole("admin")

 

 

B. CONDITION Specific for ...

find_real_file.png

09.Condition

gs.getSession().isInteractive()  && !query.includes('activeANYTHING')

 

C. Codifying

find_real_file.png

10. Script

please see below...

"var query = gs.getUrlOnStack(); "

in this case i'm usign URL to verify the item (catalog) and allow some specific catalog item to search for inactive users.                           

var query = gs.getUrlOnStack();
var vactive = true;
if (query) {
	if (!query.includes("88ca63d2dba8e3c02511fa910f96196d") )
		{vactive = false;}
	if (!query.includes("62a7bfaf0a0a0a6500c49682bd82376a") )
		{vactive = false;}
	
	if (vactive == true)
		{current.addActiveQuery();}
}
else {
	current.addActiveQuery();
}

 

 

image

 Summary

Governance: Technical Best Practices eBook

Version history
Last update:
‎11-28-2019 12:59 PM
Updated by: