client-scripts

Generate ServiceNow client scripts for form events using g_form and GlideAjax.

77|23|Updated Jul 16, 2025
One-click install
npx skills add https://github.com/groeimetai/snow-flow --skill client-scripts-groeimetai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: client-scripts
Source: https://github.com/groeimetai/snow-flow/tree/main/packages/opencode/src/bundled-skills/client-scripts
Command: npx skills add https://github.com/groeimetai/snow-flow --skill client-scripts-groeimetai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies the creation and management of client-side scripts in ServiceNow, enabling dynamic form behavior and efficient user interactions.

Core Features & Use Cases

  • Dynamic Form Control: Implement onLoad, onChange, onSubmit, and onCellEdit scripts to control form elements, validate input, and provide real-time feedback.
  • API Guidance: Provides clear examples and best practices for using the g_form and g_user APIs, as well as GlideAjax for server communication.
  • Use Case: Automatically set default values on form load, validate user input before submission, or fetch related data from the server based on field changes.

Quick Start

Use the client-scripts skill to create an onLoad client script that sets the priority field to '3' when a new incident record is created.

Frequently Asked Questions about client-scripts

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

FAQPage Schema
How do I write a ServiceNow client script to validate form fields before submission?

To validate form fields before submission in ServiceNow, you use an onSubmit client script combined with the g_form API to check field values and return false to cancel the save if validation fails.

What is the difference between onLoad and onChange client scripts in ServiceNow?

ServiceNow onLoad client scripts execute when a form renders, ideal for setting default values, whereas onChange scripts trigger dynamically when a specific field's value is modified by the user.

How do I use GlideAjax in a ServiceNow client script to query server-side data?

GlideAjax enables asynchronous server communication in ServiceNow client scripts by calling a script include, passing parameters, and processing the returned data to update form fields dynamically.

Can I use g_user object properties to check roles in a ServiceNow client script?

Yes, the g_user object in ServiceNow client scripts provides client-side properties like userName and roles, allowing you to check user permissions without making additional server calls.

What are common performance best practices for ServiceNow client-side scripting?

Performance best practices for ServiceNow client-side scripting include avoiding synchronous server calls, minimizing DOM manipulation, and using GlideAjax efficiently to prevent form load delays.

When should I use an onCellEdit client script instead of onChange in ServiceNow?

Use the onCellEdit client script in ServiceNow when you need to validate or manipulate data directly within a list view cell, whereas onChange is restricted to standard form field modifications.