servicenow-client-scripts

Guide ServiceNow client-side scripting with onChange guards and GlideAjax patterns.

Updated Mar 24, 2026
One-click install
npx skills add https://github.com/Xerrion/servicenow-opencode-config --skill servicenow-client-scripts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: servicenow-client-scripts
Source: https://github.com/Xerrion/servicenow-opencode-config/tree/main/skills/servicenow-client-scripts
Command: npx skills add https://github.com/Xerrion/servicenow-opencode-config --skill servicenow-client-scripts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps teams establish robust, reusable standards for client-side ServiceNow development, preventing brittle scripts and inconsistent patterns.

Core Features & Use Cases

  • Guidance on onChange guards to prevent execution during form load, GlideAjax usage for asynchronous server calls, and proper use of g_scratchpad to share data between server and client.
  • Clear decision guidance on when to use UI Policies versus Client Scripts, plus typical use cases like form validation, dynamic field population, and cross-field dependencies.
  • Use case: A developer implements safe, maintainable browser-side logic across multiple forms and modules, reducing defects and speeding delivery.

Quick Start

Load this skill when writing Client Scripts, UI Policies, or any browser-side ServiceNow code to follow best-practice patterns.

Frequently Asked Questions about servicenow-client-scripts

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

FAQPage Schema
How do I prevent a ServiceNow client script from executing during form load?

Use an onChange guard in your ServiceNow client script to check if the script is running during form initialization, preventing unintended execution when the form loads and avoiding brittle field behavior.

What is the best way to share data between server and client in ServiceNow?

Use the g_scratchpad object in ServiceNow to pass data from a server-side display business rule to client-side scripts, ensuring efficient data sharing without requiring additional asynchronous server calls.

When should I use UI Policies versus Client Scripts in ServiceNow?

Use UI Policies for standard field visibility and mandatory configurations, and reserve Client Scripts for complex logic like dynamic field population or cross-field dependencies that UI Policies cannot handle.

How do I make asynchronous server calls from a ServiceNow client script?

Use the GlideAjax pattern in your ServiceNow client script to execute asynchronous server-side code, enabling safe data retrieval and processing without freezing the browser interface.

Does this skill guide GlideAjax usage and g_scratchpad patterns for ServiceNow?

Yes, this skill provides guidance on using GlideAjax for asynchronous server calls and g_scratchpad for sharing data between server and client, establishing reusable client-side scripting standards.

Why do my ServiceNow client scripts behave inconsistently across different forms?

Inconsistent ServiceNow client script behavior often stems from missing onChange guards, improper GlideAjax usage, or unclear boundaries between UI Policies and Client Scripts, which this skill addresses.