Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

What is the difference between a business rule and script include?

vsashwin364
Kilo Contributor

Hi I am a newcommer to ServiceNow - exploring the platform. I know both are server-side script, but what makes them different.

 

7 REPLIES 7

Tanushree Maiti
Tera Patron

Hi @vsashwin364 

 

AspectBusiness RuleScript Include
PurposeExecutes business logic automatically when a database operation occursStores reusable functions or classes that can be called from other scripts
ExecutionTriggered automatically by record events (Insert, Update, Delete, Query, Display)Runs only when explicitly invoked
TypeEvent-driven server-side scriptReusable server-side code library
Trigger MechanismDatabase activity on a specific tableCall from Business Rule, Scripted REST API, Flow Action, UI Action, Background Script, etc.
TableAssociated with a specific tableNot tied to a table
ReusabilityLimited. Logic is usually specific to one table/processHigh. Same code can be reused across multiple applications and tables
PerformanceCan impact performance if many rules execute unnecessarilyBetter for reusable logic because code loads only when called
Typical Use CasesData validation, field population, triggering events, enforcing business policiesUtility methods, common calculations, reusable integrations, shared data processing
Configuration OptionsBefore, After, Async, Display; Conditions; Order; Insert/Update/Delete/QueryName, API Name, Client Callable, Accessible From
MaintenanceCan lead to duplicated logic if similar code exists in multiple rulesCentralized logic, easier maintenance
Best PracticeKeep focused on triggering and validation logicPlace complex/reusable logic here and call it from Business Rules
ExampleWhen Incident Priority = 1, automatically notify managerFunction IncidentUtils.getManager() used by multiple Business Rules
Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

AndersBGS
Tera Patron

Hi @vsashwin364 

 

A business rule is a single piece of logic that trigger based on trigger conditions. A script include is a container for reusable scripts that can trigger based on client side or server side script. 

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

radha050903
Tera Contributor

 

Hello @vsashwin364 ,

Business Rule is a server-side script that runs automatically whenever a record is created, updated, deleted, displayed, or queried. It is mainly used to perform backend tasks based on changes to a record. For example, when an Incident is closed, a Business Rule can automatically close all related child tasks or update another record.

Script Include is a reusable server-side code that contains one or more functions. Instead of writing the same logic repeatedly, you write it once and call it wherever it is needed. Think of it like pickle with food—you prepare it once, and whenever you need it, you simply use it. Similarly, a Script Include is written once and reused from different places.

Simple examples:

  • Business Rule: When a user creates an Incident, automatically set the priority based on the Impact and Urgency.

  • Script Include: Create a function to calculate the priority. Then call that same function from a Business Rule, Flow Designer, Service Portal, Scheduled Job, or Scripted REST API whenever you need it. This avoids writing the same logic multiple times.

I hope this helps!