servicenow
Original:🇺🇸 English
Translated
Interact with ServiceNow instances via the jsn CLI. Use when working with ServiceNow development, administration, or data exploration. Handles tables, records, business rules, flows, script includes, ACLs, update sets, and more. Triggered by ServiceNow URLs (service-now.com, servicenow.com) or when the user mentions ServiceNow, jsn, servicenow, or related terms like tables, records, business rules, flows, script includes, ACLs, update sets, or encoded queries.
5installs
Sourcejacebenson/jsn
Added on
NPX Install
npx skill4agent add jacebenson/jsn servicenowTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Jace's ServiceNow CLI
Explore and manage ServiceNow instances. Works standalone or with AI agents.
Agent Invariants
MUST follow these rules:
- Choose the right output mode — when parsing data;
--jsonwhen presenting to humans--md - Use sys_id for updates — All update/delete operations require sys_id
- Check auth first — Run if commands fail
jsn auth status - Profile scope — Use or switch with
--profile <name>jsn config switch <name>
Output Modes
| Goal | Flag | Format |
|---|---|---|
| Parse data, pipe to jq | | JSON envelope: |
| Show results to user | | Markdown tables |
| Automation/scripting | | JSON + quiet + no interactive prompts |
| Raw data only | | JSON data without envelope |
JSON Envelope
Every command supports :
--jsonjson
{
"ok": true,
"data": [...],
"summary": "5 tables",
"breadcrumbs": [
{"action": "show", "cmd": "jsn tables show incident", "description": "View details"}
]
}Breadcrumbs suggest next commands for navigation.
Quick Reference
| Task | Command |
|---|---|
| List tables | |
| Show table schema | |
| List table columns | |
| Create table | |
| Add column to table | |
| Query records | |
| Show record | |
| Count records | |
| Create record | |
| Create with file | |
| Update record | |
| Delete record | |
| List business rules | |
| Show rule script | |
| List flows | |
| List script includes | |
| Show script code | |
| List ACLs | |
| List update sets | |
| Set current update set | |
| List choices | |
| List jobs | |
| Run job | |
| List forms | |
| Show list columns | |
| List list views | |
| List UI policies | |
| List client scripts | |
| List catalog items | |
| List item variables | |
| List variable choices | |
| Add variable choice | |
| Variable types | |
| Search docs | |
| Compare instances | |
| Generate code | |
| Run background script | |
| Run script from file | |
Command Categories
Tables & Schema
bash
jsn tables list --json # All tables
jsn tables list --search "incident" # Filter by name
jsn tables list --app "global" # Filter by scope
jsn tables show incident --json # Table details (alias: get)
jsn tables schema incident --json # Inheritance tree
jsn tables columns incident --json # Column definitions
jsn tables create u_my_table --label "My Table" # Create table
jsn tables create u_assets --label "Assets" --extends cmdb_ci # Extend existing
jsn tables add-column u_my_table u_desc --type string --label "Description"
jsn tables add-column u_my_table u_ref --type reference --reference sys_userRecords (CRUD operations)
bash
jsn records list <table> --json # List records
jsn records list <table> --query "active=true" --limit 10 # With filter
jsn records list <table> --fields "number,short_description" # Specific fields
jsn records show <table> <sys_id> --json # Single record (alias: get)
jsn records count <table> --query "priority=1" # Count
jsn records create <table> -f short_description="Test" # Create with fields
jsn records create <table> -f script=@/tmp/script.js # Read value from file
jsn records create <table> --data '{"field":"value"}' # Create with JSON
jsn records update <table> <sys_id> -f state=2 # Update with fields
jsn records update <table> <sys_id> -f script=@/tmp/fix.js # Update from file
jsn records delete <table> <sys_id> --force # Delete
jsn records variables <ritm_sys_id> --json # Catalog variablesBusiness Rules
bash
jsn rules list --table incident --json # Rules on table
jsn rules show <sys_id> --json # Rule details
jsn rules script <sys_id> # Output just the scriptFlows
bash
jsn flows list --json # All flows
jsn flows list --active --json # Active only
jsn flows show <name> --json # Flow detailsScript Includes
bash
jsn script-includes list --json # All script includes
jsn script-includes list --scope global # Filter by scope
jsn script-includes show <name> --json # Details
jsn script-includes code <name> # Output just the codeACLs
bash
jsn acls list --table incident --json # ACLs on table
jsn acls show <sys_id> --json # ACL details
jsn acls script <sys_id> # Output condition script
jsn acls check --table incident --operation read # Test coverageUpdate Sets
bash
jsn updateset list --json # All update sets
jsn updateset show <name> --json # Details
jsn updateset use <name> # Set as current
jsn updateset create <name> # Create new
jsn updateset parent <child> <parent> # Set parentChoices
bash
jsn choices list <table> <column> --json # List choices
jsn choices create <table> <column> --value 5 --label "Critical"
jsn choices update <sys_id> --label "New Label"
jsn choices delete <sys_id> --force
jsn choices reorder <table> <column> --mode hundredsJobs & Scheduling
bash
jsn jobs list --json # All jobs
jsn jobs list --type scheduled # Scheduled only
jsn jobs show <sys_id> --json # Job details
jsn jobs executions <sys_id> --json # Execution history
jsn jobs run <sys_id> # Execute nowUI Configuration
bash
jsn forms list --table incident --json # Form views
jsn forms show incident --view default --json # Form layout
jsn lists list --table incident --json # List views
jsn lists show incident --json # List columns (Default view)
jsn lists show incident --view "Default view" # List columns for specific view
jsn ui-policies list --table incident --json # UI policies
jsn ui-policies script <sys_id> # Policy script
jsn client-scripts list --table incident --json # Client scripts
jsn client-scripts script <sys_id> # Script code
jsn ui-scripts list --json # UI scriptsService Portal
bash
jsn sp list --json # Portals
jsn sp show <id> --json # Portal details
jsn sp-widgets list --json # Widgets
jsn sp-pages list --json # PagesService Catalog
bash
jsn catalog-item list --json # List catalog items
jsn catalog-item list --active --json # Active items only
jsn catalog-item show <sys_id> --json # Item details
jsn catalog-item variables <sys_id> --json # Variables on item
jsn variable show <name_or_sys_id> --json # Variable details
jsn variable choices <name> --json # Choices for dropdown variable
jsn variable add-choice <name> "value" "Display Text" # Add choice
jsn variable remove-choice <name> "value" # Remove choice
jsn variable-types --json # Variable type referenceNote: manages (field-level choices). Use for catalog variable dropdown choices ( table).
jsn choicessys_choicejsn variable choicesquestion_choiceLogs
bash
jsn logs --json # Recent logs
jsn logs --level error --json # Filter by level
jsn logs --source <name> --json # Filter by sourceDocumentation
bash
jsn docs list # Available topics
jsn docs gliderecord # Show topic
jsn docs search "encoded query" # Search docs
jsn docs update # Refresh cacheCross-Instance Operations
bash
jsn compare tables --source prod --target dev --json
jsn compare script-includes --source prod --target dev --name "MyUtil"
jsn compare choices --source prod --target dev --table incident --column priority
jsn export script-includes --name "MyUtil" --output ./scripts
jsn export tables --name incident --output ./schemaRaw REST API
bash
jsn rest get /api/now/table/incident?sysparm_limit=5 # GET (query params auto-encoded)
jsn rest post /api/now/table/incident --data '{"short_description":"test"}'
jsn rest patch /api/now/table/incident/<sys_id> --data '{"state":"2"}'
jsn rest delete /api/now/table/incident/<sys_id> # Shows confirmation on success
jsn rest get /api/x_myapp/custom_api/resource # Custom/scoped APIsBackground Scripts (eval)
bash
jsn eval "gs.print(gs.getProperty('instance_name'))" # Inline script
jsn eval --file /tmp/check_records.js # Script from file
echo "gs.print('hello')" | jsn eval # Piped from stdin
jsn eval --scope x_myapp_scope "gs.print(gs.getCurrentScopeName())" # Run in app scope
jsn eval --no-rollback "gs.print('skip rollback')" # Disable rollback recording
jsn eval --no-quota "gs.print('no timeout')" # Disable 4-hour timeout
jsn eval "gs.print(JSON.stringify({user: gs.getUserName()}))" --json # JSON outputEquivalent to "Scripts - Background" in the ServiceNow UI. Uses internally.
Use or to produce output. Full server-side API access (GlideRecord, gs, etc.).
sys.scripts.dogs.print()gs.info()Code Generation
bash
jsn generate gliderecord --table incident
jsn generate script-include --name "MyUtil"
jsn generate rest --name "MyAPI"
jsn generate acl --table incident --operation read
jsn generate test --table incidentConfiguration
~/.config/servicenow/ # Global config
├── config.json # Profiles and settings
└── credentials.json # Auth tokens (fallback)
.servicenow/ # Per-repo config (optional)
└── config.json # Project-specific settingsProfiles
bash
jsn config list # List profiles
jsn config add # Add new profile
jsn config switch <name> # Switch active profile
jsn --profile prod tables list # Use specific profileAuthentication
bash
jsn auth login # Interactive login
jsn auth status # Check auth
jsn auth logout # Clear credentialsEnvironment variables:
- — Override stored token
SERVICENOW_TOKEN - — Override instance URL
SERVICENOW_INSTANCE
Interactive Pickers
Commands with arguments open pickers when omitted:
[optional]bash
jsn tables show [<name>] # Opens picker if name not provided
jsn rules show [<id>] # Opens picker if id not provided
jsn updateset use [<name>] # Opens picker if name not providedAlias: works as an alias for on all commands (e.g., , ).
getshowjsn records getjsn tables getGlobal Flags
--config <path> # Use specific config file
--profile <name> # Use specific profile
--json # Output as JSON
--quiet, -q # Output data only (no envelope)
--md # Output as Markdown
--agent # Agent mode (JSON + quiet + no prompts)
--jq <filter> # Apply jq filter to JSON outputError Handling
bash
jsn auth status # Check authentication
jsn instance info # Check connectivityCommon errors:
- Auth error →
jsn auth login - Not found → Verify sys_id or table name
- Forbidden → Check user roles/permissions
System Tables Reference
| Area | Tables |
|---|---|
| Tables | |
| Choices | |
| Business Rules | |
| Script Includes | |
| Flows | |
| ACLs | |
| Update Sets | |
| UI Policies | |
| Client Scripts | |
| Forms | |
| Jobs | |
| Logs | |
| Service Portal | |
| Service Catalog | |