Code Snippets
Store, organize, and quickly insert reusable code snippets in any ServiceNow script field.
Last updated: February 19, 2026
Last updated: February 19, 2026
Code Snippets is a library of reusable code templates that you can insert into any ServiceNow script field with a quick keyboard shortcut. Instead of retyping common patterns or digging through old scripts, press ⇧⇧ (double Shift) to open the snippet search and insert code in seconds.
If your Pro or Enterprise account does not have any snippets yet, SN Utils shows a small demo set in the popup so you can explore how snippet search and insertion work right away.
That's it. The popup appears over your editor, you search, select, and the snippet is inserted.
Snippets come from three sources, listed in priority order (highest priority wins when names overlap):
Snippets you create yourself. These are personal and override any other snippet with the same name.
Snippets shared by your team members via a Team Workspace. These are read-only but can be synced to your extension.
Community-curated snippet packs available from the marketplace. These provide a foundation of common patterns.
When multiple snippets have the same trigger, your custom snippet takes precedence over a team snippet, which takes precedence over a pack snippet.
Snippets are organized by category to help you find what you need:
| Category | Use For |
|---|---|
| Script | General-purpose scripts |
| Client | Client-side scripts (UI Policies, Client Scripts, UI Actions) |
| Server | Server-side scripts (Business Rules, Script Includes, Scheduled Jobs) |
| Other | Non-script content (XML, JSON, text templates) |
Each snippet can be scoped to a specific context. When you open the quick search, only snippets matching your current context are shown:
| Context | When It Appears |
|---|---|
| Any | Always shown in every script field |
| Script | Shown in general script fields |
| Client | Shown in client-side script fields |
| Server | Shown in server-side script fields |
This keeps the search results relevant — you won't see server-side GlideRecord snippets when editing a Client Script, and vice versa.
Your custom snippets are synced to the cloud as part of your Pro subscription. This means:
{{variables}} for dynamic content with live data