VS Code Sync

Install and use sn-scriptsync to sync ServiceNow scripts with VS Code for a better development experience.

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.

Installing sn-scriptsync

Configuration

Check the auto-start setting:

Matching names to auto start

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.

WebSocket server status

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):

sn-scriptsync in action

Workflow

  1. Click the save icon next to the script field
  2. Helper tab opens - Acts as a proxy between the instance and VS Code via WebSocket
  3. Script syncs to VS Code - Stored in: instance/scopename/tablename/fieldname.extension
  4. Edit in VS Code - Make changes and save
  5. Changes sync back - Updates appear instantly in ServiceNow

First-Time Instance Approval

The first time you sync from an instance, you need to approve connectivity in the helper tab:

Approve instance in helper tab

  1. Helper tab icon turns red when attention needed
  2. Approve connectivity (one-time per instance)
  3. Activity log shows all sync operations

After approval, the instance is saved and future syncs work automatically.

Load All Scope Scripts

Instead of syncing files one by one, pull in all scripts for a scope:

Load all scripts

  1. Click the sn-scriptsync icon in the VS Code activity bar
  2. Click Load Scope at the bottom
  3. Watch requests in the helper tab
  4. Files appear organized by table type (similar to Studio layout)

Context Menu and Command Palette

Most options are available via context menu or command palette:

Context menu

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