script-includes

Develop reusable class-based Script Includes with GlideAjax patterns for ServiceNow.

34|13|Updated Feb 6, 2026
One-click install
npx skills add https://github.com/Happy-Technologies-LLC/happy-servicenow-skills --skill script-includes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: script-includes
Source: https://github.com/Happy-Technologies-LLC/happy-servicenow-skills/tree/main/skills/development/script-includes
Command: npx skills add https://github.com/Happy-Technologies-LLC/happy-servicenow-skills --skill script-includes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Duplicative server-side logic across multiple ServiceNow apps creates maintenance burdens and inconsistent behavior. This skill provides a structured approach to building Script Includes using class-based patterns, client-callable (GlideAjax) implementations, and inheritance to promote reuse, testability, and scalable utilities.

Core Features & Use Cases

  • Class-based Script Includes: Encapsulate logic in well-defined, reusable classes with clear interfaces and lifecycle.
  • Client-callable (GlideAjax): Expose server-side methods to client scripts safely, with proper security checks and parameter handling.
  • Extending & Inheriting: Extend out-of-the-box Script Includes and platform classes to tailor behavior without duplicating code.
  • Common Design Patterns: Singleton, Factory, and Strategy patterns to manage configuration, object creation, and task routing.
  • Guidance & Best Practices: Prerequisites, naming conventions, and testing approaches to ensure maintainable code across apps.

Quick Start

Create a basic Script Include named IncidentUtils with a simple class and a few methods, then call it from a client script using GlideAjax to fetch data.

Frequently Asked Questions about script-includes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create reusable server-side code in ServiceNow to avoid duplicating logic across apps?

Reusable server-side code in ServiceNow is created using class-based Script Includes that encapsulate logic in well-defined classes with clear interfaces, promoting maintainability and consistent behavior across multiple applications.

What's the best way to call server-side logic from a client script in ServiceNow safely?

The best way to call server-side logic from a client script is using client-callable Script Includes with GlideAjax, which safely expose server methods while incorporating proper security checks and parameter handling.

Can I extend out-of-the-box Script Includes in ServiceNow without duplicating code?

You can extend out-of-the-box Script Includes and platform classes in ServiceNow by using inheritance, allowing you to tailor platform behavior to specific requirements without duplicating existing code.

What design patterns work well for managing object creation and task routing in ServiceNow server-side code?

Common design patterns like Singleton, Factory, and Strategy work well for ServiceNow server-side code, effectively managing configuration, object creation, and task routing in a structured, scalable manner.

Do I need to follow specific naming conventions when building Script Includes for production-ready usage?

Following specific naming conventions is required when building Script Includes, as established best practices ensure maintainable code, clear interfaces, and standardized server-side logic across applications.

Why should I use class-based Script Include patterns instead of standard functions in ServiceNow?

Class-based Script Include patterns should be used instead of standard functions in ServiceNow because they provide structured templates, support inheritance, and promote testability for scalable server-side utilities.