Creating Snippets
How to create, edit, organize, and manage your custom code snippets.
Last updated: February 19, 2026
Last updated: February 19, 2026
Custom snippets are code templates you create for patterns you use often. They live in your SN Utils account, sync across devices, and can be shared with your team.
The fastest way to create a snippet is with the AI Assistant. Open the AI side panel and describe what you need in plain language — for example, "create a GlideAggregate snippet that counts incidents by category". The AI generates a complete snippet with a name, prefix, category, context, and working code — ready to save and use immediately.
/manage)
| Field | Required | Description |
|---|---|---|
| Name | Yes | A short, descriptive name (shown in search results) |
| Prefix | No | A shorthand trigger (e.g., gr for GlideRecord). If set, typing the prefix filters results faster |
| Category | Yes | Script, Client, Server, or Other |
| Context | Yes | Where the snippet appears: Any, Script, Client, or Server |
| Description | No | A brief explanation of what the snippet does. Shown below the name in search results |
| Code | Yes | The actual code template to insert |
Use descriptive placeholder text that guides the user on what to replace:
var gr = new GlideRecord('TABLE_NAME');
gr.addQuery('FIELD', 'VALUE');
gr.query();
while (gr.next()) {
// your code here
}
Snippets preserve formatting and indentation. Write your snippet exactly as you want it inserted:
(function() {
var ga = new GlideAjax('YOUR_SCRIPT_INCLUDE');
ga.addParam('sysparm_name', 'YOUR_METHOD');
ga.addParam('sysparm_value', VALUE);
ga.getXMLAnswer(function(response) {
var result = JSON.parse(response);
// handle result
});
})();
Short snippets work great for common expressions:
gs.getUser().getID()
Pick the right category so your snippets appear in the right context:
The quick search matches against both the name and the prefix. Choose names that describe the pattern:
Set a short prefix for your most-used snippets. When you type in the quick search, prefix matches appear first:
| Prefix | Snippet |
|---|---|
gr | GlideRecord basic query |
gre | GlideRecord with encoded query |
ga | GlideAjax call |
rest | RESTMessageV2 outbound |
log | gs.info with formatted message |
From the website or the Manage page, find the snippet and click to open it. Make your changes and save.
Open the snippet and click Delete. If the snippet is shared with your team, deleting it removes it from everyone's sync.
You can share snippets with your team through the Sharing feature:
Team members can then browse and sync your shared snippets.
You can include {{variables}} in your snippet code to create dynamic templates. When the snippet is used in clipboard mode (outside an editor), variables are resolved with live data from the current record and your user profile.
For example, a greeting snippet:
Hi {{caller_id.first_name}},
Kind regards,
{{$first_name}}
See Snippet Variables for the full syntax and examples.
{{variables}} with live data