Legacy - Production deployment tips

  • Release version: Xanadu
  • Updated August 1, 2024
  • 5 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Legacy - Production deployment tips

    This guidance addresses deploying ServiceNow customizations to production instances, focusing on the tradeoffs between using the application repository versus Git source control. It highlights important considerations for ServiceNow customers managing scoped and global applications, especially with legacy deployment methods and the evolving capabilities introduced since the Paris release. Notably, the legacy ServiceNow Studio is being deprecated, so customers should use the current Studio for app development.

    Show full answer Show less

    Key Concepts and Terminology

    • Application repository: Primary location for deploying applications to production, operating similarly to the ServiceNow Store.
    • Source control (Git repository): Enables continuous development but can cause unintended effects when deploying directly to production.
    • Scoped vs. Global applications: Scoped apps restrict operations within their scope and are common for new development; global apps are legacy and often customize core ServiceNow products.
    • Update sets: Standard method for packaging and migrating incremental customizations between instances.
    • Delta loading: Introduced with Paris release, this method incrementally updates applications from source control without full uninstall/reinstall, preserving data unless schema elements are removed.
    • Rollback: Administrators can revert the last application installation from the application repository, removing all associated updates.

    Practical Deployment Considerations

    • Applications deployed via source control are managed as “In development” entries, unlike “Installed” applications deployed from the Store or repository; these deployment models are mutually exclusive.
    • Delta loading reduces risk by only applying changes incrementally, but absent files in a new package are deleted, which can impact functionality and data.
    • Global applications preserve schema and data during source control installs; scoped applications may drop schema and data if schema elements are missing in the target branch—extreme caution is advised when switching branches in production.
    • Direct edits to source control repositories, especially removals, can cause data loss and cascading deletions. Avoid such actions or perform them with great care.
    • Author-elective features allow setting properties during application repository installs to control delete and choice behaviors.

    Operational and Development Guidance

    • Legacy rollback capability supports administrators in undoing the most recent application install from the repository, fully removing code and schema changes.
    • Upgrade history is automatically recorded for source control installations, providing traceability of changes.
    • For efficient performance and safer deployments, customers should develop applications using the current ServiceNow Studio and follow best practices regarding schema changes and source control management.

    When you develop customizations to applications on the ServiceNow® platform, you deploy them via the application repository to a production instance. This topic examines and provides cautions for the tradeoffs between installing an application from the application repository versus Git repository with source control.

    Important:
    Starting with the Xanadu release, the legacy version of ServiceNow Studio is being prepared for future deprecation. It will be hidden and no longer activated on new instances but will continue to be supported. For details on the deprecation process, see the Deprecation Process [KB0867184] article in the Now Support Knowledge Base.

    Try building and editing apps in the current version of ServiceNow Studio instead. For more information, see Building applications with ServiceNow Studio.

    Overview

    Technically, you can still “deploy” an application from a Git repository to a production instance using source control. This can have unintended consequences.

    Glossary of terms

    Term Definition
    Metadata or application files The sys_metadata records that define configuration in ServiceNow and are packaged in an application. These records alter the behavior of the instance but do not contain data such as incident or CMDB records. (See Note below)
    Scoped applications ServiceNow applications that restrict allowing only updates and operations within the boundary of the scope. This mechanism is used for most new development.
    Global applications Global applications are developed in the legacy global scope. Work is often done in this scope to customize existing ServiceNow applications such as IT Service Management (ITSM).
    Application repository Applications are typically published here for deployment in production instances. Although the application repository has separate entitlement rules, it operates similarly to the ServiceNow Store.
    ServiceNow Store Repository for third-party (vendor) applications as well as ServiceNow published applications. Most customers do not publish to the Store, but often install applications from it.
    Update sets Standard method of packaging customizations for deployment in each successive instance. They contain the incremental collection of insertions, updates, and deletions.
    Legacy - Delta loading The most efficient method of loading because it changes only from source control rather than earlier uninstall/reinstall methods.
    Schema Definition of tables and columns in the tables.
    Rollback Administrators can roll back the last installation of a selected application. A rollback removes all code, table, and file updates from the initial installation.
    Note:
    The sys_metadata table is the parent table of all application files in the ServiceNow platform using the table inheritance model. You can view summary information for metadata by visiting the parent table or tables that extend directly or indirectly as indicated by the Extends table(super_class) field on the Table(sys_db_object record). You can also see the whole schema by visiting the Table(sys_db_object) form for the sys_metadata table and selecting the Show Schema Map related link at the bottom of the form. The schema is large and so takes some time to render.

    Schema mapping

    Schema map table of contents

    Installation location

    When you install source control, it facilitates the ongoing development of a custom application. Therefore, the application is managed as an “In development” application in the Custom Application [sys_app] table rather than as an “Installed” application in the Store Application [sys_store_app] table. Both tables are extensions of sys_scope so they both provide the same protections and restrictions as the scope. So when you search for the installation of a source control deployed application, refer to the System Application [sys_app] table and the in development section of the Application Manager page.

    You cannot have a sys_app record on the instance while deploying that same application from the ServiceNow Store or application repository. The two deployment models are mutually exclusive. If at any point the deployment model changes, the sys_app record must be converted to a sys_store_app record first. You can contact ServiceNow Support for help with performing that operation.

    Delta loading

    Prior to the ServiceNow Paris release, application installation from source control always removed and reinstalled the entire application when triggered, including the Apply Remote Changes function. With Legacy - Delta loading, now only the changes update, simplifying the process considerably.

    The Delta loading process loads the changes from source control incrementally. When you apply remote changes, you don’t drop existing tables or columns unless they were removed from the repository. This preserves the data for tables and fields that continued to be present.
    Note:
    The glide.source_control.allow_delta_loading_in_scopedapp property allows you to disable Delta loading in Paris; however, this will revert to the more destructive behavior of removing and reinstalling the application. Global applications in Paris always use Delta loading.
    Below is a table of the different expected outcomes in an instance using Delta loading.
    Application type Install source Schema present in package Schema contains data Claim by another app (Global) Expected outcome for data and schema
    Scoped Application repository or Store Yes Yes/No N/A Preserved
    Scoped Application repository or Store No Yes/No N/A Preserved
    Scoped Source control Yes Yes/No N/A Preserved
    Scoped Source control No Yes/No N/A Removed
    Global Source control, Application repository, or Store Yes Yes/No Yes/No Preserved
    No Yes No Preserved (1)
    No No Yes Preserved (2)
    Source control No No No Removed (3)
    Application repository No No No Preserved
    Note:
    • While the database schema and the data are preserved, they will be moved into the default global application.
    • While the database schema and the data are preserved, they will be moved into the global application which previously held claim to these files if installed. Otherwise, they will move into default global application.
    • Applicable only on custom columns with u_ prefix. ServiceNow platform-authored columns are not dropped.

    When switching branches in source control for a scoped application, use extreme caution in a production environment. If the target branch is missing schema elements found in the current branch, the related schema is dropped, destroying any data it contains. (Global applications do not drop schema when data is present.)

    Just as with update sets, only a subset of the incremental changes needs to be applied with Delta loading. Unlike update sets, the application package represents the complete application. Files that are absent from the new package are deleted. This can alter functionality and delete data. Update sets and applications upgraded from the application repository or ServiceNow Store must have an explicit DELETE payload to remove a file or drop a schema.

    If application files are being generated dynamically in any fashion, the next install/apply remote changes the operation of an application deletes those records. They are considered absent from the incoming application package. If you stash local changes, the application files may be recoverable by a stash commit, but if data is lost as a result of the changes, the data is not recovered.
    Note:
    Removing or suppressing sys_update_xml records prevents them from being removed by Delta loading; however, this action can have other severe or undesirable results.

    Direct edits to the repository, especially to remove files, can have significant ramifications, including loss of data and cascading deletes. Perform this action with care.