VS Code Sync
Install and use sn-scriptsync to sync ServiceNow scripts with VS Code for a better development experience.
Last updated: January 24, 2026
sn-scriptsync enables real-time synchronization between ServiceNow scripts and VS Code.
Installing in VS Code
Search for "sn utils" or "scriptsync" in the Extensions panel and install it.
Configuration
Check the auto-start setting:
Create a folder matching the setting name (default: scriptsync). When you open this folder in VS Code, the WebSocket server automatically starts.
After opening the folder, you'll see the status in the VS Code status bar.
Click to start or stop the server manually.
Basic Usage
In SN Utils settings, ensure Enable sn-scriptsync buttons (VS Code) is checked.
Open a script record (try /si creatorconutils):
Workflow
- Click the save icon next to the script field
- Helper tab opens - Acts as a proxy between the instance and VS Code via WebSocket
- Script syncs to VS Code - Stored in:
instance/scopename/tablename/fieldname.extension - Edit in VS Code - Make changes and press Ctrl+S / Cmd+S
- Changes sync back - Updates appear instantly in ServiceNow
Which Saves Sync
Only Ctrl+S / Cmd+S with focus in the file editor pushes it to the instance. Pressing Save with focus in the terminal, Search or Explorer does not push the active file. Other saves wait in the Pending Saves panel until you sync them there with Sync Now or the per-file check mark:
- Save All
- A rename across files (F2), which VS Code saves automatically in every file it changed, including files of other instances
- Auto save
- Saves made by another extension
These held saves are never pushed by the auto-sync timer or by an AI agent. Requires sn-scriptsync 4.9.15 or later.
- Prefer to push only from Pending Saves? Turn off Ctrl+S / Cmd+S syncs the file in the sn-scriptsync Settings.
- Rebound your Save key or use a Vim extension? Bind it to the sn-scriptsync: Save & Sync command.
- Saving from the editor's Find box: Ctrl+S / Cmd+S saves locally and puts the file in Pending Saves. Return focus to the editor text and press Ctrl+S / Cmd+S to sync it.
- Older sn-scriptsync versions do not say which saves came from Ctrl+S, so the helper tab asks you to review their saves before pushing them. When several arrive together, none are selected until you pick them.
- Helper reviews stay current: a newer ScriptSync change to the same fields removes the older review, and replacement contents need a fresh selection. Disconnecting the tool discards its pending helper reviews; send those saves again to review them after reconnecting.
First-Time Instance Approval
The first time you sync from an instance, you need to approve connectivity in the helper tab:
- Helper tab icon turns red when attention needed
- Approve connectivity (one-time per instance)
- Activity log shows all sync operations
After approval, the instance is saved and future syncs work automatically.
The approval dialog also has an Automatic token refresh switch for the instance. It is on by default and can be changed later in the Instances tab; see Staying connected after a restart.
The Connectivity Strip
The top of the helper tab shows a modem-style LED strip: the connected editor (VS Code, Cursor) and every instance that exchanged traffic this session, with LEDs that flicker on activity. Click the strip to expand per-instance details (actions, last activity) and to reach:
- Pause agents — one click blocks incoming AI-agent commands (they get a clear "paused" reply) while your own editor saves keep working; click again to resume.
- Connect an agent (Pro) — copies a short instruction block that lets any AI agent (Claude Code, Codex, Windsurf) connect to ScriptSync; see AI Agent Support.
- Manage — jumps to the Instances tab with the full allow/block lists.
The animations respect the SN Utils Reduce Motion setting.
Write History
The helper tab keeps a history of every write it sends to an instance: saves from VS Code, queued file changes, agent requests and snu commands. It works without Debug Logging and survives closing the tab.
Each entry records:
- the time, instance, table, record and field names
- how the write started: Ctrl+S (Save & Sync), a sync from Pending Saves, a save you approved in the helper tab, a queued file change, an agent request or a manual command
- the connected tool: VS Code or SN Utils CLI
- the HTTP result
Script contents, tokens, cookies and query strings are never stored. The latest 5,000 entries are kept in your browser profile.
Open the helper tab's Settings tab and click View write history to see it, newest first. Filter by text, instance, tool or result, and click a record to open it on the instance. The viewer shows the latest 500 matching writes; Export saves the full history as a JSON file. Clear history removes it.
A few things to keep in mind when reading it:
- An HTTP result shows that the instance answered. It does not prove every change was applied, for example inside a background script.
- An entry without a result was interrupted before the instance answered.
- Changes made in the ServiceNow UI or through another browser profile do not appear.
- The tool shows which program sent the write. It does not show whether a person or an AI agent started a
snucommand.
Load All Scope Scripts
Instead of syncing files one by one, pull in all scripts for a scope:
- Click the sn-scriptsync icon in the VS Code activity bar
- Click Load Scope at the bottom
- Watch requests in the helper tab
- Files appear organized by table type (similar to Studio layout)
Large applications are loaded completely: every table is paged past the Table API limits, and the completion message tells you how many records and tables were loaded. AI agents get the same in one call through the pull_scope Agent API command (snu pull-scope <scope> from the CLI); see AI Agent Support.
Context Menu and Command Palette
Most options are available via context menu or command palette:
Context Menu Visibility
The sn-scriptsync context menu commands only appear when the server is running. You can also hide them completely using the showContextMenu setting, with optional per-language overrides:
{
"sn-scriptsync.showContextMenu": true,
"[markdown]": {
"sn-scriptsync.showContextMenu": false
}
}
Additional Resources
- sn-scriptsync on GitHub — Source, changelog, and issue tracker
- YouTube tutorials — Video walkthroughs and demos