Commands and command arguments available to the base system ServiceNow CLI.

Global command arguments

Use command arguments to set options for any CLI commands.

--help

Provides help information for the specified command, which includes the description, supported arguments, and examples. For more information, see Get help with ServiceNow CLI.

$ snc --help
--debug

provides debug logging output when executing a command. For more information, see Get help with ServiceNow CLI.

$ snc record delete --table incident --sysid 552c48888c033300964f4932b03eb092 --debug
--profile

Specifies the named profile to use for a command. For more information, see Configuring and managing your ServiceNow CLI connection profiles.

$ snc configure profile set --profile <profilename>
--output

Specifies the output format to use for a command. The ServiceNow CLI supports the following output formats.

  • json: The output is formatted as JSON. This is the default.
    
    {
       "default": {
          "appversion": "1.0.8",
          "host": "https://myinstance.service-now.com",
          "hostversion": "Paris",
          "loginmethod": "basic",
          "output": "json",
          "username": "admin"
       },
       "user1": {
          "appversion": "1.0.8",
          "host": "https://otherinstance.service-now.com",
          "hostversion": "Paris",
          "loginmethod": "basic",
          "output": "yaml",
          "username": "admin"
       }
    }
  • yaml: The output is formatted as YAML. Use YAML to handle the output with services and tools that emit or consume YAML-formatted strings.
    default:
       appversion: 1.0.8
       host: https://myinstance.service-now.com
       hostversion: Paris
       loginmethod: basic
       output: json
       username: admin
    user1:
       appversion: 1.0.8
       host: https://otherinstance.service-now.com
       hostversion: Paris
       loginmethod: basic
       output: yaml
       username: admin
  • text: The output is formatted as multiple lines of tab-separated string values. Use this output with traditional UNIX text tools such as grep, sed, and awk, and the text processing performed by PowerShell.
    default   https://myinstance.service-now.com   Paris   1.0.8   basic   admin   json 
    user1   https://otherinstance.service-now.com   Paris   1.0.8   basic   admin   yaml
  • table: The output is formatted as a table which presents the information in a human-readable format.
    NAME   HOST   HOST   VERSION   APP   VERSION   LOGIN   METHOD   USERNAME   OUTPUT 
    -------------------------------------------------------------------------------
    default   myinstance   Paris   1.0.8   basic   admin   json 
    user1   otherinstance   Paris   1.0.8   basic   admin   yaml
  • none: The CLI does not print the output to the console. Success, error, and progress messages still display.
$ snc record query --table incident --query ‘active=true’ --output json
--no-interactive
Prevents the CLI from prompting the user for argument values. If the user does not pass a value for a required argument, the system uses the default value. If no default value is defined, the system throws an error.
--no-verbose
The command executes silently without messages.​ Use this argument in automated testing scenarios.

Configure profile

Create a connection profile to connect with your instance, view connection profiles, refresh your connection and available commands, or delete profiles you no longer need. For more information about configuring your profile, see Configuring and managing your ServiceNow CLI connection profiles.

Set up a default profile

Create a connection profile that the ServiceNow CLI uses by default. You must create a default profile to set up the CLI's initial connection with an instance.

$ snc configure profile set

The system prompts you for the following information:

Set up a named profile

Create a named connection profile to use with specific commands. This allows you to specify a different instance or connection protocol for a specific command.

$ snc configure profile set [--profile profile-name]

The system prompts you for the following information:

View profiles

View all connection profiles set in the configuration file, or view information about a specific profile.

$ snc configure profile list [--profile profile-name]
Remove a profile

Remove a named connection profile that you no longer need from the configuration file.

$ snc configure profile remove [--profile profile-name]
Refresh a profile

Update the available commands from the instance for the given profile. Refresh your connection after modifying any of the commands on the corresponding instance in order to keep the CLI up-to-date.

$ snc configure profile refresh [--profile profile-name]

Perform record operations

Create, read, update, delete, and query records in your instance using the ServiceNow CLI command-line tool. For more information about performing record operations, see Perform record operations using ServiceNow CLI.

Create a record

Inserts a single record in a specified table.

$ snc record create [--table table --data data]

Pass in values for these arguments.

Parameter Description
table Required. Name of the table in which to save the record.
data Required. Field name and the associated value for each field to define in the specified record in JSON string format.
Delete a record

Deletes the specified record from the specified table.

$ snc record delete [--table table --sysid sys_id]

Pass in values for these arguments.

Parameter Description
table Required. Name of the table in which to delete the record.
sysid Required. Sys_id of the record to delete.
Get a record

Retrieves a single record based on the specified sys_id from the specified table.

$ snc record get [--table table --sysid sys_id]

Pass in values for these arguments.

Parameter Description
table Required. Name of the table from which to retrieve the record.
sysid Required. Sys_id of the record to retrieve.
Query records

Retrieves multiple records from a specified table.

$ snc record query [--displayvalue displayValue --fields fields --limit limit --offset offset --query query --table table]

Pass in values for these arguments.

Update a record

Updates the specified record with the given data attributes.

$ snc record update [--sysid sys_id --table table --data data]

Pass in values for these arguments.

Parameter Description
table Required. Name of the table in which to save the record.
sysid Required. Sys_id of the record to update.
data Required. Field name and the associated value for each field to define in the specified record in JSON string format.

Work with extensions

Add extensions to the ServiceNow CLI to load additional functionality and commands, update existing extensions, or remove extensions you no longer need. For more information, see Manage ServiceNow CLI extensions.

Find available extensions
$ snc extension list-available -o table
Install an extension
$ snc extension add --name <extension-name>
Update an extension
$ snc extension update --name <extension-name>
Remove an extension
$ snc extension remove --name <extension-name>

Use the ui-component extension

Add the ui-component extension

Add the ui-component extension to the ServiceNow CLI.

$ snc extension add --name ui-component
Set up your project

Create the component project and the set of files required to develop a component. You can connect to your instance and create an application scope for your component, or you can reserve a scope to verify later.

$ snc ui-component project [--name name --description description --scope scope --offline]

Pass in values for these arguments.

Run the development server

Add your component code and test it using a local development server.

$ snc ui-component develop [--entry entry --open --port port --host host]

Pass in values for these arguments.

Deploy a component to an instance

Deploy your component to display in your instance as an application plugin.

$ snc ui-component deploy [--open --force]

Pass in values for these arguments.

Name Description
open When true, opens the default browser and navigates to UI Builder in your instance.

Default: false

force Deploys component changes and overwrites any existing component records.

Default: false.