Exploring the ServiceNow SDK
Summarize
Summary of Exploring the ServiceNow SDK
The ServiceNow SDK enables developers to create and modify scoped applications locally using Visual Studio Code, then install those applications on a non-production ServiceNow instance. Available since the Washington DC release, this approach allows offline development and leverages Visual Studio Code features not available in the ServiceNow IDE.
Show less
Using the SDK, developers can define application metadata with ServiceNow Fluent, write custom JavaScript modules, and include third-party libraries. The SDK also provides a command-line interface (CLI) to manage synchronization and deployment between local projects and ServiceNow instances.
ServiceNow SDK Workflow
- Install the ServiceNow SDK locally.
- Authenticate to a non-production ServiceNow instance using the CLI with administrator privileges.
- Create a new scoped application or convert an existing one from the instance for local development.
- Develop the application in Visual Studio Code by defining metadata, coding modules, and managing dependencies.
- Build the application locally to compile source code into instance-compatible metadata.
- Install the application back onto the instance via the CLI.
- Synchronize local code with instance updates by transforming metadata between local and instance environments.
- Manage source code versioning using your preferred Git provider; other developers should clone from Git repositories rather than directly transforming from the instance.
Benefits for ServiceNow Customers
- Offline Development: Work independently of the ServiceNow instance, using Visual Studio Code with advanced development features.
- Source Control Integration: Use Git to manage application code, enabling collaboration and version management.
- Enhanced Application Definition: Define application metadata programmatically using ServiceNow Fluent for better control and flexibility.
- Reusable Code: Organize and reuse JavaScript modules and third-party libraries within scoped applications to streamline development.
- Efficient Deployment: Use CLI commands for authenticating, building, installing, and synchronizing applications between local environments and ServiceNow instances.
Learn about developing scoped applications in source code locally and installing changes on an instance with the ServiceNow SDK.
ServiceNow SDK overview
With the ServiceNow SDK, you can create and modify scoped applications locally in Visual Studio Code Desktop and install those applications on a non-production instance beginning with the Washington DC release. By developing applications locally, you can work offline and use features that are available in Visual Studio Code but not in the ServiceNow IDE.
In Visual Studio Code, you can develop scoped applications in source code using ServiceNow Fluent to define application metadata [sys_metadata], write custom JavaScript modules, or add third-party libraries.
The ServiceNow SDK includes a command-line interface (CLI) for managing changes between an instance and a local application. Using simple CLI commands, you can authenticate to an instance, create or convert an application, transform application metadata (XML) into ServiceNow Fluent code, build and install the application on the instance, and more.
The ServiceNow SDK also serves as the application packaging service that builds applications in the ServiceNow IDE. For more information, see Exploring the ServiceNow IDE.
ServiceNow SDK workflow
The following infographic shows the workflow for developers to get started developing applications with the ServiceNow SDK.
- A developer installs the ServiceNow SDK locally. For more information, see Install the ServiceNow SDK in an application.
- Using the CLI, the developer authenticates to a non-production instance to interface between their local environment and the instance with the
now-sdk authcommand. The developer must have the admin role on the instance. - The developer creates a scoped application (
now-sdk init) or converts an existing scoped application from the instance (now-sdk init --from) for use with the ServiceNow SDK. - In Visual Studio Code, the developer can define application metadata in source code using ServiceNow Fluent, create custom JavaScript modules, or use third-party libraries.
They can also download application and script dependencies from the instance to code against (
now-sdk dependencies). - The developer builds the application, which compiles the source code and transforms it into application metadata for the instance (
now-sdk build). - The developer installs the application on the instance (
now-sdk install). - Other users can continue to modify the application metadata on the instance, and developers can reuse the code from modules in other modules or scripts within the application.
- The developer downloads and transforms application metadata from the instance to get the latest updates to the application metadata locally (
now-sdk transform), keeping it synchronized with the application on the instance.
You can manage applications in source control with your preferred Git provider. To develop a scoped application on another system with the ServiceNow SDK, other developers should clone the application from a remote GIt repository rather than downloading and transforming it from the instance.
ServiceNow SDK benefits
| Benefit | Feature | Users |
|---|---|---|
| Develop applications offline, outside of an instance in Visual Studio Code and manage them in source control with your preferred Git provider. | Developing applications with the ServiceNow SDK | Developers |
| Write source code to define the metadata that makes up ServiceNow applications | ServiceNow Fluent | Developers |
| Organize and reuse code within scoped applications with custom JavaScript modules and third-party JavaScript utilities | JavaScript modules and third-party libraries | Developers |