The CLI resolves the target instance in this order: --target flag → SN_TARGET env var → sn.config.ts targetInstance → the registry default. Credentials are stored only in the registry; the CLI never reads passwords from project files.
Instance Setup
Connect to your ServiceNow instance
Use a sub-production (dev/test) instance for learning. The CLI creates real records on your instance.
Tasks
1
Register your instance in the CLI credential store. Credentials land in `~/.sn-skills/instances.json` (mode 0600), not in the project.
sn instance add default \
--url your-instance.service-now.com \
--user admin \
--pass - \
--default
# --pass - reads from stdin; avoids exposing the password in ps(1)2
Test the connection by fetching a system property.
sn get sys_properties "name=glide.servlet.uri" --fields value[
{ "value": "https://your-instance.service-now.com/" }
]
Next Level
First Schema Query
Explore table structures on your instance