Build and installdeploy an application with the ServiceNow SDK

  • Freigeben Version: Australia
  • Aktualisiert 12. März 2026
  • 2 Minuten Lesedauer
  • Build and installdeploy a local application developed with the ServiceNow SDK on a ServiceNow instance.

    Vorbereitungen

    Add an application to your local system with the ServiceNow SDK. For more information, see Adding applications with the ServiceNow SDK.

    Role required: admin

    Warum und wann dieser Vorgang ausgeführt wird

    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.

    Hinweis:
    To build global applications with the ServiceNow SDK, you should use Node Package Manager (npm) as your package manager, especially if your application has more complex dependencies.

    Prozedur

    1. In Visual Studio Code, open your scoped application directory.
    2. From the application directory, open an integrated Terminal window.
    3. Download changes to the application from the instance with the transform command to stay up to date with changes locally.
      now-sdk transform --auth <alias>
      Changes to application metadata are downloaded and synchronized into source code. If metadata exists in the local application as both XML and source code, the XML version takes precedence when installed on the instance.
      Hinweis:
      Updates to JavaScript modules aren't included when downloading application metadata from your instance.​
    4. Fetch your application to stay up to date with changes to its metadata on the instance using the fetch command:
      now-sdk fetch --auth <alias>
      Hinweis:
      Updates to JavaScript modules aren't included when downloading application metadata from your instance.​
    5. Build your application using the build command.
      now-sdk build
      The build artifacts are output to the dist/app directory, including the metadata as XML files in the dist/app/update directory. The installable package is output to the target directory.
    6. Build your application using one of the following build commands depending on the source code of modules in your application.
      Module source codeCommand
      JavaScript source
      now-sdk build
      TypeScript source
      npm run build

      This command compiles TypeScript files into JavaScript modules and builds your application. For more information about using TypeScript in your application, see Using TypeScript in JavaScript modules with the ServiceNow SDK.

      The build artifacts are output to the dist/app directory, including the metadata as XML files in the dist/app/update directory. The installable package is output to the target directory.
    7. InstallDeploy your application using the installdeploy command.
      now-sdk install --auth <alias>
      Warnung:
      If you set the --reinstall parameter to true with the installdeploy command, application metadata created by other developers on your instance can be removed. Any application metadata on your instance that is not present in the local installment package generated during the build process is removed during installment. Before building your application, use the now-sdk transformnow-sdk fetch command to synchronize your local metadata with the metadata on your instance.

    Ergebnisse

    The application is updated on your instance to reflect your local changes. ServiceNow Fluent code is compiled into application metadata, and modules in the application are added to the EcmaScript Module [sys_module] table on the instance.

    Hinweis:
    If you have previous versions of modules in the EcmaScript Module [sys_module] table that aren't needed, re-installing an application removes previous versions of the application’s modules from the table.