---
sourceDocument: Australia Build or modify applications
sourceDocumentLink: https://www.servicenow.com/docs/r/australia/application-development

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Business rules and script includes

# Business rules and script includes {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read
Summarize  
![AI sparkle icon](https://servicenow.com/docs/portal-asset/ai-sparkle-icon) Summarized using AI  
This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.  

## Summary of Business rules and script includes

Business rules in ServiceNow are server-side scripts that run during CRUD (Create, Read, Update, Delete) operations on records.
They automate actions such as setting field values, validating data, triggering notifications, and updating related records.
Script Includes are reusable JavaScript objects or functions designed to centralize server-side logic for use across multiple scripts like Business Rules, UI Actions, workflows, and APIs.
Show full answer Show less  

## Best Practices for Business Rules

* Keep Business Rules small, focused, and condition-based to improve performance and ease debugging.
* Avoid modifying base system Business Rules and prefer Script Includes for reusable logic instead of global Business Rules.
* Use queries to limit the number of records processed within a Business Rule.
* Avoid client-callable Business Rules to enhance client script efficiency.
* Do not use `current.update()` inside Business Rules to prevent recursive loops and duplicate processing.

## Business Rule Execution Types and Use Cases

| Type | When It Runs | Practical Use | Example |
|-|-|-|-|
| Before | Synchronously before the database operation | Set or update values on the current record, validate data, or abort the operation if needed. | Set the state of a record based on another field before saving. |
| After | Synchronously after the database operation | Trigger events, notifications, or update related records sequentially, with access to previous values. | Cascade field values to child records after the record is updated. |
| Async | Asynchronously after the database operation completes | Run long-running processes or updates when immediate results are not required, without blocking the user. | Trigger external processes or update many related records without impacting user experience. |
| Display | Every time a form is displayed | Make server-side data available to client-side scripts, e.g., via `gscratchpad`. | Provide user-related information on a form for client-side use. |

## Using Script Includes

Script Includes allow you to define reusable server-side functions or classes, which can be invoked from multiple script types such as Business Rules, UI Actions, workflows, and APIs. This modular approach promotes code reuse, easier testing, and maintenance. Instead of duplicating logic or calling one script from another (e.g., Business Rule from UI Action), encapsulate shared code in a Script Include and call it where needed.

## Benefits to ServiceNow Customers

* Improved performance and maintainability by following best practices and using Script Includes.
* Better control over when and how server-side logic runs during record operations.
* Ability to implement efficient, scalable automation and integrations without risking recursive loops or excessive database operations.
* Enhanced client-server interaction through Display Business Rules and `gscratchpad`.  
Business rules are server-side actions that can be run during CRUD (Create, Read, Update, Delete) operations on instance records.  
Note:  
Consider creating applications with help from agentic AI. For more information, see [Agentic development on the ServiceNow AI Platform](https://www.servicenow.com/docs/vYjVrbMquxnuvAGczSbXYQ "Build and enhance custom applications using the generative and agentic AI capabilities available on the ServiceNow AI Platform. The capabilities support every stage of development, from generating application components to vibe coding full-stack applications through natural language conversations.").

Some good practices when using Business Rules are:

* Keep Business Rules small and specific.
* Avoid modifying base system Business Rules.
* Use Script Includes instead of global Business Rules.
* Use scripting only when necessary.
* Store reusable script logic in a script include.
* Use queries to limit records processed within a Business rule.
* Avoid client-callable Business Rules to improve efficiency when running client scripts.
* Always use a condition with Business Rules to control when the Business Rule runs. Running Business Rules with conditions can also aid in debugging. Business Rules rarely run with no conditions.

{#business-rules-and-script-includes__ul_ecz_vy2_5xb}

Business Rules can be configured to run before or after a database operation. They can also be configured to run asynchronously and also before displaying a form or executing a query.  
{#business-rules-and-script-includes__table_sp2_yy2_5xb__entry__4}

| Value | Runs | When to Use | Example |
|-|-|-|-|
| Before | Synchronously before the database operation | Set or update values on the current object as part of the save operation. Validate and abort execution if required. | A developer wants to set the state of the current record based on another input in that record. |
| After | Synchronously after the database operation | Trigger events and notifications after the database update to access the previous object or to make something occur in sequence. Update related records other than the base table being updated to access the previous object or to make something occur in sequence. | A developer wants to cascade values from the current record down to child records. |
| Async | Asynchronously executed as a separate process after the database operation is completed | The process triggered by the rule may take a while to run. When the user who triggered the operation does not need the output right away. Trigger events, notifications, or related record updates when access to the previous values of the record or a specific sequence of actions is not required. | A developer needs to trigger an external process that may take a while or update a large number of records. |
| Display | Executed every time the corresponding form is displayed | Used to make server-side objects available to client-side scripts. | A developer wants to write information about a user associated with the current record to the g_scratchpad object to use in a client-side script. |
[ ]

{#business-rules-and-script-includes__table_sp2_yy2_5xb}  
Note:  
current.update()should not be used in any Business Rules. Using current.update()triggers an additional database operation, which could cause duplicate notifications, recursive loops, etc.

Use Script Includes to store JavaScript functions and classes for use by server scripts. Each Script Include defines either an object class or a function that can be reused among any server-side scripts. For more information, see [Script includes](https://www.servicenow.com/docs/access?context=c_ScriptIncludes&version=australia&pubname=australia-api-reference&ft:locale=en-US).

Store any code that might need to be used elsewhere in a Script Include. Call the Script Include from a Business Rule, UI Action, workflow script, Scripted REST API, etc. Instead of calling a Business Rule from a UI Action or a UI
Action from a Scripted REST API, put the code in a Script Include and call the Script Include from both places.

Keeping functions in a Script Include allows testing of the function before deploying the function in other scripted areas, thus reducing overall development and testing time.

For more information, see [Classic Business rules](https://www.servicenow.com/docs/access?context=c_BusinessRules&version=australia&pubname=australia-api-reference&ft:locale=en-US).

