what are global business rule in snow & and when to use

Kishore Babu S
Tera Contributor

what are global business rule in snow & and when to use? 

1 ACCEPTED SOLUTION

Bhawana Upreti
Tera Guru

Hello,

Adding to Jon, A global Business Rule is any Business Rule where the selected Table is Global. Any other script can call global Business Rules. Global Business Rules have no condition or table restrictions and load on every page in the system. Most functions defined in global Business Rules are fairly specific, such as an advanced reference qualifier on one field of one form. There is no benefit to loading this kind of script on every page. 

Script includes only load when called. If you have already written a global Business Rule, move the function definition to a Script Include. The name of the Script Include must match the name of the function for the Script Include to work properly. There is no need to modify any calls to the named function.

Thanks.

View solution in original post

4 REPLIES 4

Jon Barnes
Kilo Sage
My view is that you should never use global business rules. I haven’t found a reason why I ever needed to use one instead of a script include. I think they were a convention that was used early on, but essentially abandoned as the servicenow platform matured. Happy to hear another view on that if there actually is a valid use case for them any more.

This doc also indicates to use script includes instead of global BRs: https://docs.servicenow.com/bundle/kingston-application-development/page/script/server-scripting/concept/c_ScriptIncludes.html

Bhawana Upreti
Tera Guru

Hello,

Adding to Jon, A global Business Rule is any Business Rule where the selected Table is Global. Any other script can call global Business Rules. Global Business Rules have no condition or table restrictions and load on every page in the system. Most functions defined in global Business Rules are fairly specific, such as an advanced reference qualifier on one field of one form. There is no benefit to loading this kind of script on every page. 

Script includes only load when called. If you have already written a global Business Rule, move the function definition to a Script Include. The name of the Script Include must match the name of the function for the Script Include to work properly. There is no need to modify any calls to the named function.

Thanks.

Brian Dailey1
Kilo Sage

Hi Jon,

Tagging along on what Jon and Bhawana have said, the use of Global Business Rules to provide some functionality that can be accessed from anywhere in the platform has been replaced by use of On-Demand Script Includes (also called "classless").  As per Bhawana, your function and the name of the Script Include need to be identical for this to work properly (i.e., where you can simply call the function elsewhere in your code without having to instantiate a new object).

The only scenario-type I can think of where you might want to create your own global business rule is if you needed some function to automatically run every time something happened with records in ANY table.  But honestly, I cannot come up with any examples of that scenario, and I wouldn't recommend this as a solution in general.

Hope that helps.

-Brian