What This Table Is
The sys_script_include table stores reusable server-side JavaScript libraries that promote code reusability and maintainability across the ServiceNow platform. These Script Includes contain functions and classes that can be invoked from Business Rules, Scheduled Scripts, REST APIs, Flow Designer custom actions, and other Script Includes. They serve as the platform's primary mechanism for creating shared server-side code libraries.
This table is owned by the Development module and supports the entire application development lifecycle. Script Includes are fundamental to ServiceNow architecture because they allow developers to centralize business logic, utility functions, and integrations that would otherwise be duplicated across multiple Business Rules or other server-side scripts.
Script Includes don't extend any parent table and no standard tables extend them. They are standalone configuration records that contain JavaScript code. The table has a direct relationship with sys_scope for application scoping and sys_package for update set management.
Large enterprises typically have 500-2000 Script Includes, with performance depending heavily on the access field value. Global Script Includes are loaded into memory on instance startup and cached, while private Script Includes are loaded on-demand. The table performs well for reads but developers should avoid querying it frequently in loops since each Script Include evaluation can trigger additional script compilation.
When You'll Script Against This Table
You'll primarily query this table in Business Rules that need to dynamically load or validate Script Includes, in Scheduled Scripts that manage code deployment, and in REST APIs that provide development tools functionality. Background scripts commonly query this table when performing bulk operations on Script Includes or analyzing code dependencies. Discovery and ServiceMapping also query this table when building application dependency maps.
Access is controlled by the admin role for full CRUD operations, while the script_admin role provides read access. Application scope affects visibility - Script Includes in private scope are only accessible within their application. The access field further restricts availability at runtime.
Common scripting patterns:
- Query by name to validate Script Include exists before dynamic instantiation
- Find all Script Includes in a specific scope for application auditing
- Search script content for deprecated API usage or security patterns
- Count Script Includes by access level for governance reporting
- Update multiple Script Includes during deployment automation
- Clone Script Includes across scopes while maintaining dependencies
- Generate documentation by parsing description and script content
Table Gotchas
The api field must be true for the Script Include to be callable from other server-side scripts. Setting it to false makes the Script Include only available for on-demand loading via GlideScriptedProcessor.
Script Includes with access='public' are loaded into global memory and cached. Changing the script content requires an instance restart or cache flush to take effect in some contexts.
- The
scriptfield is a longtext field that can hit size limits with very large JavaScript files - ServiceNow recommends keeping Script Includes under 64KB - Querying by
scriptfield content using CONTAINS can be extremely slow - use indexed fields likenameorsys_scopewhen possible
Script Includes in private scope cannot call Script Includes in different private scopes, even if both are active. Only global scope Script Includes are universally accessible.
- The
client_callablefield only affects Ajax calls from client scripts - it doesn't impact server-side accessibility at all - Inactive Script Includes (
active=false) can still be instantiated and called if cached from when they were active - deactivation isn't always immediate
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.
Related Tables
Script Includes don't extend any parent table, making them unique among ServiceNow configuration objects. They are self-contained JavaScript libraries that stand alone in the platform architecture. However, they have critical relationships with scoping and package management tables that affect their visibility and deployment.
The most important relationship is with sys_scope, which determines Script Include visibility across applications. The sys_package table tracks Script Includes in update sets for deployment. Developers frequently join with sys_metadata when building dependency maps or performing impact analysis on Script Include changes.
When troubleshooting Script Include issues, developers commonly query syslog_transaction and syslog tables alongside Script Includes to trace execution errors. The sys_script (Business Rules) and sys_ws_operation (Web Services) tables are frequently queried together when analyzing which scripts call specific Script Includes.