Manage files in the config data model using file nodes

  • Release version: Washingtondc
  • Updated February 1, 2024
  • 5 minutes to read
  • Add and manage files using file nodes in the config data model of a CDM app or in a component library.

    Before you begin

    Important:
    Starting with the Washington DC release, DevOps Config is being prepared for future deprecation. It will be hidden and no longer installed on new instances but will continue to be supported. For details, see the Deprecation Process [KB0867184] article in the Now Support Knowledge Base.

    Role required: cdm_editor or cdm_admin

    About this task

    When you attach a file to an applicable node, a file node is created under that node. The file node contains a link to the attached file that stores configuration data. For example, a properties file or a logo image file.
    • In an app, you can add the file node to a node under the component, collection, or deployable folder. The file nodes in a component are also included when you include a component to a collection and the collection to the deployable in an app. You can override the file nodes included at the collection or deployable level, like any other config data item.
    • In a component library, you can add a file node to a node under a shared component. When the shared component is used in an app, the file nodes are copied along with the file attached to them.
    App developers and members of the authoring group of the app can access the file nodes and also download their attached files. They can manually validate the content of the file and then publish the snapshot. DevOps users can export the validated config data, including file nodes with URLs to the attached files hosted on the ServiceNow instance where the export was executed.

    Procedure

    1. Navigate to All > DevOps Config > DevOps Config Workspace.
    2. Open a DevOps Config app or a component library to add a file node to its config data model.
      OptionSteps
      Adding a file node in an app
      1. Select the apps icon (DevOps Config apps icon) in the left navigation pane.
      2. Select an app from the Applications list.
      3. Select Edit config data to open a changeset.
      Adding a file node in a component library
      1. Select the component libraries icon (Component libraries icon.) in the left navigation pane.
      2. Select a component library to open or create one.
      3. Select Edit to open a changeset.
      A changeset is opened with the Config data tab selected.
    3. In the config data tree, select the more actions icon (More actions icon.) next to a node to which you want to add a file node, and then select the Add file from the menu.
      Note:
      In an app, you can add a file node to a node under the component, collection, or deployable, but not directly to the component, collection, or deployment folder in an app. In a shared library, you can add a file node to a node under a shared component.
    4. Add a file to create a file node.
      1. In the Add file dialog box, browse and select a file from your system, and select Add file.
        You can add a MIME-type file supported by the ServiceNow AI Platform with a maximum file size of 5 MB.
      2. In the Node name field, provide a name for the file node.
        By default, the attached file name is populated as the file node name. The Content type field is also populated with the content type of the attached file.
      3. Select Add file.
      The file node is added to the selected node. Select the file node in the config data tree to display its metadata in the File information pane and preview the file's content in the File content pane.
      Note:
      The content preview is available for the files with the following MIME types: text/yaml,text/css,text/csv,text/html,text/javascript,text/plain,text/richtext,text/x-vcard,text/x-vcalendar,application/xml,application/javascript,application/json. To view content for additional MIME type files, add them as a comma separated list to the system property sn_cdm.attachment.display_mime_types. The preview is not available for binary file MIME types, such as audio, image, and video.

      A file node added to a component node.

    5. Optional: After the file node is added to the config data, you can perform the following actions on the file node or the file attachment within it.
      Note:
      All actions on the file node or its file attachment can only be done via the More actions menu on the file node.
      ActionSteps
      Rename the file node
      1. Select the more actions icon next to the file node, and then select Rename from the menu.
      2. In the Rename dialog box, enter a new name of the file node in the Node name field.

      If the file node is included in the collection, it’s renamed there as well.

      Extract variables
      1. Select the more actions icon next to the file node, and then select Extract variables from the menu.
      2. In the Extract variables dialog box, specify the file path you want to extract the variables to.

      All variables in the file node tagged as @@<variableName>@@ are extracted to the file path you specified. The variable is then modified to also include the file path.

      You can then resolve all the extracted variables. Define the extracted variables and then select Apply variables from the form context menu. This action replaces all extracted variables in the file content with the defined variable values.

      Delete the file node
      1. Select the more actions icon next to the file node, and then select Delete from the menu.
      2. In the Delete pop-up, select Delete.
      Deleting the file node has the following effect on it and its file attachment:
      • If the file node is included in the collection, it’s also deleted from there. Any overridden file node becomes a direct file node.
      • If the file node is created in the currently opened changeset that is not yet committed, then the file node and its file attachment are permanently deleted.
      • If the file node was created in a previously committed changeset and is deleted in the currently opened changeset, then the file node is deleted from the config data but the file attachment remains in the system.
      Download the file attachment Select the more actions icon next to the file node, and then select Download file from the menu.

      Alternatively, you can download the file by selecting the file node and then selecting Download on the File information pane.

      Replace the file attachment
      1. Select the more actions icon next to the file node, and then select Replace file from the menu.
      2. In the Replace file dialog box, attach a file from your system, and select Replace file.
      Override an included file node If a file node is included in a collection and into a deployable, then you can override it by replacing the attached file with a new one.
      1. Select the more actions icon next to the included file node in the collection or deployable folder, and then select Replace file from the menu.
      2. In the Replace file dialog box, attach a file from your system, and select Replace file.