Configuration

Table of contents

  1. .snsyncrc
    1. Instance name
    2. Sync settings (tables)
  2. VS Code settings
    1. General
    2. Auth
    3. Status bar
      1. Minimal mode (recommended for most users)
      2. Expanded mode (power users)
      3. All available command IDs

.snsyncrc

The .snsyncrc file lives in your workspace root and holds the non-sensitive sync configuration. It is created automatically by sn: init. Commit it to your repository — it contains no credentials.

Never put passwords or tokens in .snsyncrc. Credentials are managed by sn: auth and stored in VS Code Secret Storage.

Instance name

{
  "instance": "mycompany"
}

This is the subdomain of your ServiceNow URL. For https://mycompany.service-now.com, use mycompany.

To update it, run sn: init again or edit the file directly.

Sync settings (tables)

The settings array defines which ServiceNow tables and fields are synced. Each entry maps a table to the script field(s) you want to pull and push.

sn: init pre-populates the most common script tables:

Table name Record type
sys_script Business Rules
sys_script_include Script Includes
sys_script_client Client Scripts
sys_ui_action UI Actions
sys_security_acl ACL Scripts
sysauto_script Scheduled Jobs
sysevent_script_action Script Actions
sp_widget Service Portal Widgets

You can add, remove, or modify entries to match the tables your project uses.


VS Code settings

These settings are configured in VS Code (Cmd+, / Ctrl+, or settings.json).

General

Setting Default Description
sn-sync.rootDir (workspace root) Override the root directory where pulled files are saved
sn-sync.pull.clearBeforePull false Delete the pull destination folder contents before each pull
sn-sync.pull.skipEmptyFields false Skip writing a local file for a pulled field when its ServiceNow content is empty, instead of creating a 0-byte file

Auth

Setting Default Description
sn-sync.auth.allowCustomHosts false Allow non-ServiceNow hosts for instance URL validation. Disabled by default for security
sn-sync.auth.customHosts [] Exact custom hostnames allowed when sn-sync.auth.allowCustomHosts is enabled (for example: sn.company.com)

Only enable sn-sync.auth.allowCustomHosts if you connect to a ServiceNow instance behind a custom domain. It relaxes the host validation that otherwise restricts auth to *.service-now.com.

Status bar

The status bar gives you one-click access to common commands without opening the Command Palette.

Setting Default Description
sn-sync.statusBar.enabled true Show sn-sync items in the status bar
sn-sync.statusBar.mode minimal minimal (single menu button) or expanded (individual buttons)
sn-sync.statusBar.visibleCommands (all) Subset of command IDs to show in the status bar or menu

One status bar button that opens a quick-pick menu:

{
  "sn-sync.statusBar.enabled": true,
  "sn-sync.statusBar.mode": "minimal",
  "sn-sync.statusBar.visibleCommands": ["sn-sync.pull", "sn-sync.push"]
}

Expanded mode (power users)

Individual buttons for each command:

{
  "sn-sync.statusBar.enabled": true,
  "sn-sync.statusBar.mode": "expanded",
  "sn-sync.statusBar.visibleCommands": [
    "sn-sync.auth",
    "sn-sync.pull",
    "sn-sync.pull-current",
    "sn-sync.pull-table",
    "sn-sync.pull-by-sys-id",
    "sn-sync.push",
    "sn-sync.push-current",
    "sn-sync.push-modified",
    "sn-sync.push-report",
    "sn-sync.open-current-in-instance"
  ]
}

All available command IDs

sn-sync.sn-init
sn-sync.auth
sn-sync.auth-config
sn-sync.auth-validate
sn-sync.reset
sn-sync.reset-auth
sn-sync.run-background-script
sn-sync.open-current-in-instance
sn-sync.pull
sn-sync.pull-all-files
sn-sync.pull-current
sn-sync.pull-table
sn-sync.pull-by-sys-id
sn-sync.reset-index
sn-sync.push
sn-sync.push-current
sn-sync.push-modified
sn-sync.push-report