Using Snippets
How to search, preview, and insert code snippets into ServiceNow script fields.
Last updated: February 19, 2026
Last updated: February 19, 2026
Once you have snippets (your own, team-shared, or from packs), inserting them into any script field takes just a few keystrokes.
If you're on Pro or Enterprise and haven't created or installed any snippets yet, the quick search shows a built-in demo set so you can try the workflow immediately before building your own library.
Press ⇧⇧ (Shift twice quickly) while your cursor is in any script field. The snippet quick search popup appears as an overlay.

The popup works in:
Start typing to filter snippets by:
Results update as you type. The most relevant matches appear at the top.
The quick search automatically filters snippets based on your current editing context:
Client or Any context appearServer or Any context appearThis keeps results relevant without manual filtering.
Hover over or arrow-key to a snippet to see a preview of its code. This helps you confirm you're selecting the right snippet before inserting.

Press Enter or click on a snippet to insert it at your cursor position. The popup closes and the code appears in your editor.
The snippet is inserted with proper indentation, matching the indentation level of your cursor.
When multiple snippets match your search, they follow this priority:
If a custom snippet and a pack snippet have the same prefix, the custom one wins.
| Shortcut | Action |
|---|---|
| ⇧⇧ (double Shift) | Open/close the quick search popup |
| Type | Filter snippets |
| ↑ / ↓ | Navigate results |
| Enter | Insert selected snippet |
| Escape | Close popup without inserting |
When you open the snippet popup outside a script field or text area (e.g., while viewing a form without focus in an editable field), the popup switches to clipboard mode. Instead of inserting, pressing Enter copies the snippet to your clipboard.
<!-- Screenshot needed: Snippet popup in clipboard mode with "clipboard" badge visible in header and "Copy" in footer -->
In clipboard mode, any {{variables}} in the snippet are resolved with live data before copying. This is useful for preparing personalized text (greetings, status updates, work notes) that you can paste anywhere.
Look for the clipboard badge in the popup header and the Copy label in the footer to know you're in clipboard mode.
Learn more about Snippet Variables →
{{caller_id.first_name}} or {{$name}} to create snippets that auto-fill with live data when copied. See Snippet Variables.{{variables}} with live data