Skip to main content

Extend the Cloudaware ServiceNow App with a Custom Table

This guide explains how to import a new Cloudaware table into ServiceNow. The process includes defining the table structure, creating the table, adding columns, mapping fields, and configuring import settings.

info
  • Audience: ServiceNow administrators, ITSM/CMDB administrators, and Cloudaware administrators
  • Outcome: A custom Cloudaware table is available in ServiceNow and included in the Cloudaware CMDB import workflow

Prerequisites

Before you begin, install and configure the Cloudaware CMDB application. To install the application from the ServiceNow Store, follow Installation from ServiceNow Store.

High-level Setup Flow

To extend the Cloudaware ServiceNow app with a custom table:

  1. Install the Cloudaware CMDB application.
  2. Prepare the Cloudaware data and create a table in ServiceNow.
  3. Add table columns and configure metadata import.
  4. Enable the Cloudaware CI data import flow.

Select Data for Import

Identify the Cloudaware dataset that must be imported into ServiceNow. Coordinate with your dedicated Technical Account Manager to determine the relevant tables and fields.

In this guide, the Azure Virtual Machine table is used as an example; however, the workflow applies to any Cloudaware table.

Create a Table in ServiceNow

  1. In ServiceNow, navigate to System DefinitionTables.

  2. Create a table record.

  3. Set the table attributes. For example:

    FieldValue
    LabelAzure Virtual Machine
    Namex_ca_cmdb_azure_virtual_machine
    Extends tableConfiguration Item (cmdb_ci)

    Extending the cmdb_ci table ensures full usage of native Configuration Item (CI) capabilities within ServiceNow.

  4. Click Submit.

  5. Provide Cloudaware with the table label and name.

Add Columns to the Table

Columns can be added manually or populated using a custom script provided by Cloudaware. For the base application tables and import controls, see Imported Tables.

Add Columns Manually

  1. In ServiceNow, navigate to System DefinitionTables.
  2. Select the table you created, for example, Azure Virtual Machine (x_ca_cmdb_azure_virtual_machine).
  3. Click New.

The following fields are mandatory:

LabelNameType
Disappearance Timex_ca_cmdb_ca10_disappearancetime_cglide_date_time
Ca Uuidx_ca_cmdb_ca10_cauuid_cstring
Last Imported Atlast_imported_atglide_date_time
Outdatedoutdatedboolean

Add Columns Using a Script

  1. In ServiceNow, navigate to System DefinitionScripts - Background.

  2. Apply the custom script provided by Cloudaware.

    Custom script example

    The custom script provided by Cloudaware contains the required fields for the selected table. For this guide, the script is prepared for the Azure Virtual Machine table.

    // === Configuration ===
    var tableName = 'x_ca_cmdb_azure_virtual_machine';

    // === Columns ===
    var fields = [
    { label: 'Power State', name: 'x_ca_cmdb_ca10_powerstate_c', type: 'string' },
    { label: 'Name', name: 'name', type: 'string' },
    { label: 'Location Name', name: 'x_ca_cmdb_ca10_locationname_c', type: 'string' },
    { label: 'Ram Gb', name: 'x_ca_cmdb_ca10_ramgb_c', type: 'decimal' },
    { label: 'V Cpu', name: 'x_ca_cmdb_ca10_vcpu_c', type: 'decimal' },
    { label: 'Role Size Name', name: 'x_ca_cmdb_ca10_rolesizename_c', type: 'string' },
    { label: 'Id', name: 'x_ca_cmdb_ca10_id_c', type: 'string' },
    { label: 'Os Type', name: 'x_ca_cmdb_ca10_ostype_c', type: 'string' },
    { label: 'Vm Id', name: 'x_ca_cmdb_ca10_vmid_c', type: 'string' },
    { label: 'Time Created', name: 'x_ca_cmdb_ca10_timecreated_c', type: 'glide_date_time' },
    { label: 'Disappearance Time', name: 'x_ca_cmdb_ca10_disappearancetime_c', type: 'glide_date_time' },
    { label: 'Ca Uuid', name: 'x_ca_cmdb_ca10_cauuid_c', type: 'string' },
    { label: 'Last Imported At', name: 'last_imported_at', type: 'glide_date_time' },
    { label: 'Outdated', name: 'outdated', type: 'boolean' }
    ];

    fields.forEach(function(field) {
    var gr = new GlideRecord('sys_dictionary');
    gr.addQuery('name', tableName);
    gr.addQuery('element', field.name);
    gr.query();
    if (gr.next()) {
    gs.info('Field already exists: ' + field.name);
    } else {
    var f = new GlideRecord('sys_dictionary');
    f.initialize();
    f.name = tableName;
    f.element = field.name;
    f.column_label = field.label;
    f.internal_type = field.type;
    f.mandatory = false;
    f.active = true;

    f.insert();
    gs.info('Created: ' + field.label + ' (' + field.name + ')');
    }
    });

    gs.info('All fields were created: ' + tableName);
tip

Contact Cloudaware support at support@cloudaware.com to request a script for your use case.

Update the Cloudaware Import Fields Mapping Table

Add records to the Cloudaware Import Fields Mapping table (x_ca_cmdb_import_fields_mapping).

  1. In ServiceNow, navigate to System Import SetsLoad Data.

  2. Add the file generated by Cloudaware.

  3. Complete the import.

    Cloudaware Import Fields Mapping (CA10__CaAzureVirtualMachine__c)
    CI class field nameSObject field nameSObject nameCI class table
    x_ca_cmdb_ca10_powerstate_cCA10__powerState__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    nameNameCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_locationname_cCA10__locationName__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_ramgb_cCA10__ramGb__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_vcpu_cCA10__vCpu__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_rolesizename_cCA10__roleSizeName__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_id_cCA10__id__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_ostype_cCA10__osType__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_vmid_cCA10__vmId__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_timecreated_cCA10__timeCreated__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_disappearancetime_cCA10__disappearanceTime__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine
    x_ca_cmdb_ca10_cauuid_cCA10__caUuid__cCA10__CaAzureVirtualMachine__cx_ca_cmdb_azure_virtual_machine

Update the Cloudaware Import Settings Table

Add records to the Cloudaware Import Settings table (x_ca_cmdb_ci_class_import_settings).

  1. In ServiceNow, navigate to System Import SetsLoad Data.

  2. Add the file generated by Cloudaware.

  3. Complete the import.

    Update Cloudaware Import Settings (CA10__CaAzureVirtualMachine__c)
    ActiveCI Class LabelCI Class TableSObject Name
    TRUEAzure Virtual Machinex_ca_cmdb_azure_virtual_machineCA10__CaAzureVirtualMachine__c

Update the CI Class Import Table

Add records to the CI Class Import table (x_ca_cmdb_ci_class_import).

  1. In ServiceNow, navigate to System Import SetsLoad Data.

  2. Add the file generated by Cloudaware.

  3. Complete the import.

    Update CI Class Import (CA10__CaAzureVirtualMachine__c)
    Cloudaware SObject NameDisappearance Time Field NameServiceNow CI Class LabelServiceNow CI Class TableCustom Where Clause
    CA10__CaAzureVirtualMachine__cCA10__disappearanceTime__cAzure Virtual Machinex_ca_cmdb_azure_virtual_machineWHERE 1=1

Enable the Import All CI Data from Cloudaware Flow

  1. In ServiceNow, navigate to Process AutomationWorkflow Studio.
  2. Open Flows.
  3. Select the Import All CI Data from Cloudaware flow.
  4. In Trigger, click the schedule section.
  5. Select ScheduledDaily and set the run time.
  6. Click Done.
tip

The recommended import frequency is once per day.

Configure Flow Variables

In Actions, click Set Flow Variables and configure the following values:

VariableValue
Connection AliasSelect the Connections & Credentials alias configured during Cloudaware CMDB app setup, for example, Google JWT.
Cloudaware Import Settings TableLeave the auto-populated system table value.
Cloudaware Import Fields Mapping TableLeave the auto-populated system table value.
Project IdEnter the Import Project Id provided by Cloudaware.
Dataset IdEnter the Import Dataset Id provided by Cloudaware.

Click Done, then save and activate the workflow. For the standard import flow configuration, see the Workflow Studio steps in Installation from ServiceNow Store or Manual Installation.