sn-scripting

Generate ServiceNow GlideRecord and g_form scripts with execution-context guardrails.

15|2|Updated Mar 28, 2026
One-click install
npx skills add https://github.com/aatrey882/servicenow-agent-skills --skill sn-scripting
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sn-scripting
Source: https://github.com/aatrey882/servicenow-agent-skills/tree/main/sn-scripting
Command: npx skills add https://github.com/aatrey882/servicenow-agent-skills --skill sn-scripting

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

ServiceNow developers often waste time and risk incorrect code generation when writing legacy server-side and client-side scripts, especially around GlideRecord usage, execution context boundaries, and common platform gotchas.

Core Features & Use Cases

  • GlideRecord-based server scripting: Generate CRUD queries and updates using documented patterns for Business Rules, Script Includes, Scheduled Jobs, and server-side automation.
  • Client-side form scripting: Generate Client Scripts that use g_form/g_user APIs correctly, enforcing that GlideRecord is never used client-side.
  • Safety guardrails and validation: Enforce Fluent SDK detection redirection and run a validation script to catch common hallucination traps before deployment.

Quick Start

Use the sn-scripting skill to generate a Client Script that makes a field mandatory when another field changes to a specific value, using g_form APIs only.

Frequently Asked Questions about sn-scripting

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

FAQPage Schema
How do I write a ServiceNow Business Rule using GlideRecord correctly?

To write ServiceNow Business Rules using GlideRecord correctly, you must query records before calling next() and use getValue() within loops. This enforces documented server-side patterns to prevent common CRUD querying errors and platform gotchas.

Can I use GlideRecord in ServiceNow Client Scripts?

You cannot use GlideRecord in ServiceNow Client Scripts. Client-side form scripting must use g_form and g_user APIs exclusively to enforce execution-context boundaries and ensure safe client-side automation.

What is the best way to generate ServiceNow Script Includes?

The best way to generate ServiceNow Script Includes is to use guided patterns that enforce documented method usage constraints. This prevents incorrect legacy scripting by validating common gotchas and execution-context APIs before deployment.

When should I use the Fluent SDK instead of legacy ServiceNow scripting?

You should use the Fluent SDK instead of legacy ServiceNow scripting when Fluent SDK signals are detected. Legacy scripting requires explicit guardrails to route you to the sn-sdk-fluent approach when these project signals appear.

Why does my ServiceNow script fail validation before deployment?

Your ServiceNow script fails validation to catch common hallucination traps and incorrect API usage. Running validation enforces safe querying constraints like query-before-next and execution-context rules before you deploy.