Loading...
Loading...
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.
npx skill4agent add jacebenson/jsn servicenow--json--mdjsn auth status--profile <name>jsn config switch <name>| 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{
"ok": true,
"data": [...],
"summary": "5 tables",
"breadcrumbs": [
{"action": "show", "cmd": "jsn tables show incident", "description": "View details"}
]
}| 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 | |
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_userjsn 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 variablesjsn rules list --table incident --json # Rules on table
jsn rules show <sys_id> --json # Rule details
jsn rules script <sys_id> # Output just the scriptjsn flows list --json # All flows
jsn flows list --active --json # Active only
jsn flows show <name> --json # Flow detailsjsn 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 codejsn 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 coveragejsn 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 parentjsn 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 hundredsjsn 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 nowjsn 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 scriptsjsn sp list --json # Portals
jsn sp show <id> --json # Portal details
jsn sp-widgets list --json # Widgets
jsn sp-pages list --json # Pagesjsn 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 referencejsn choicessys_choicejsn variable choicesquestion_choicejsn logs --json # Recent logs
jsn logs --level error --json # Filter by level
jsn logs --source <name> --json # Filter by sourcejsn docs list # Available topics
jsn docs gliderecord # Show topic
jsn docs search "encoded query" # Search docs
jsn docs update # Refresh cachejsn 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 ./schemajsn 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 APIsjsn 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 outputsys.scripts.dogs.print()gs.info()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 incident~/.config/servicenow/ # Global config
├── config.json # Profiles and settings
└── credentials.json # Auth tokens (fallback)
.servicenow/ # Per-repo config (optional)
└── config.json # Project-specific settingsjsn config list # List profiles
jsn config add # Add new profile
jsn config switch <name> # Switch active profile
jsn --profile prod tables list # Use specific profilejsn auth login # Interactive login
jsn auth status # Check auth
jsn auth logout # Clear credentialsSERVICENOW_TOKENSERVICENOW_INSTANCE[optional]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 providedgetshowjsn records getjsn tables get--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 outputjsn auth status # Check authentication
jsn instance info # Check connectivityjsn auth login| Area | Tables |
|---|---|
| Tables | |
| Choices | |
| Business Rules | |
| Script Includes | |
| Flows | |
| ACLs | |
| Update Sets | |
| UI Policies | |
| Client Scripts | |
| Forms | |
| Jobs | |
| Logs | |
| Service Portal | |
| Service Catalog | |