Downloading dependencies with the ServiceNow SDK
Download application dependencies and TypeScript definitions from an instance for IntelliSense and validation of scripts and ServiceNow Fluent code.
Throughout the development process, you should download dependencies and TypeScript definitions from an instance to support coding against those dependencies in an application.
dependencies command with no parameters. If needed, provide the application directory and authentication alias
too.now-sdk dependencies [--directory <package path>] [--auth <alias>]Download ServiceNow Fluent application dependencies
Download TypeScript definitions for dependencies in other application scopes to get IntelliSense support and validation for ServiceNow Fluent code.
Before you begin
Add an application to your local system with the ServiceNow SDK. For more information, see Adding applications with the ServiceNow SDK.
Role required: admin
About this task
This procedure uses the ServiceNow SDK command-line interface (CLI). From a command-line tool, enter now-sdk --help to get information about the available commands and global options. To get additional information about a
command and its parameters, enter the command and --help or -h. For example, now-sdk auth --help. For more information about the CLI, see ServiceNow SDK CLI.
Procedure
What to do next
#now:{scope}/{category} subpath import format. For example:// Import roles from global scope
import { role as globalRole } from '#now:global/security'
// Import roles from custom app scope
import { role as xExampleAppRole } from '#now:x_example_app/security'
// Use in ACLs, flows, etc.
Acl({
$id: Now.ID['my_acl'],
type: 'record',
table: 'incident',
operation: 'read',
roles: [globalRole.admin, xExampleAppRole.xExampleAppCool],
})imports configuration to do so:{
"imports": {
"#now:*": "./@types/servicenow/fluent/*/index.js"
}
}Download module and script dependencies
Download TypeScript definitions for module and script dependencies to get IntelliSense support and validation for Glide APIs and script includes.
Before you begin
Add an application to your local system with the ServiceNow SDK. For more information, see Adding applications with the ServiceNow SDK.
Role required: admin
About this task
This procedure uses the ServiceNow SDK command-line interface (CLI). From a command-line tool, enter now-sdk --help to get information about the available commands and global options. To get additional information about a
command and its parameters, enter the command and --help or -h. For example, now-sdk auth --help. For more information about the CLI, see ServiceNow SDK CLI.
Procedure
Result
With this configuration, you can use the .server.js file extension for server-side scripts and .client.js file extension for client-side scripts and get type-ahead support during development.