Creating a new Table and Artifacts

Last updated on 03 September, 2024

The LogicMonitor Data Exchange (LMDX) application integrates Edwin AI with your ServiceNow instances, and comes with two full Config records for Incident and CMDB. For more information, see About LMDX.

This article describes how to set up a Config record for a new table and add associated artifacts, if the default configurations in LMDX do not support your specific use case.

Setting up a new Table

To set up a new table through LMDX, you first need to create a new configuration record. By default, only the following tables (and their children) can be selected from the drop-down on a new configuration record:

  • Task (task)
  • Configuration item (cmdb_ci)
  • Asset (alm_asset)

You can specify other tables to be included in the drop-down by using the x_lomo_dx.internal.tableWhitelist system property under the LMDX Config record properties section. Add the names (not lables) of any other table (including custom tables) that you want to synchronize.

LMDX config record option

Creating a new Config Record

Navigate to Configuration and select New. Add configuration values as described in Completing the Default Configuration.

Creating the Artifacts

You can have LMDX automatically create the artifacts by setting a system property and running a script once on your instance. You can also create the artifacts manually each time you create a new configuration record. Both methods are described in the following.

When you have created the artifacts, continue by adding new fields on the new Import Set Table, and Field Maps on the new Transform Map for inbound processing. You can also add Outbound Field Maps on the Outbound Transform Map for outbound processing.

Creating Artifacts Automatically

Follow these steps to let LMDX automatically create the required artifacts for data synchronization after you have created a new Config record.

1. Run the Global Table Script

Run the following script on your instance, either as a “Fix” script or a “Background” script.

function update(tableName){
  var updateGR = new GlideRecord('sys_db_object');
  updateGR.setWorkflow(false);
  updateGR.get('name', tableName);
  updateGR.setValue('create_access', true);
  updateGR.setValue('update_access', true);
  updateGR.setValue('delete_access', true);
  updateGR.update();
  GlideTableManager.invalidateTable(tableName);
  GlideCacheManager.flushTable(tableName);
}
update('sys_db_object');
update('sys_dictionary');
update('sys_transform_map');
update('sys_transform_entry');
update('sys_transform_script');
update('sys_script');

The script selects the “Can create”, “Can update”, and “Can delete” checkboxes for the following tables:

  • Tables (sys_db_object)
  • Dictionary (sys_dictionary)
  • Table Transform Map (sys_transform_map)
  • Field Maps (sys_transform_entry)
  • Transform Scripts (sys_transform_entry)
  • Business Rules (sys_script)
LMDX tables

This lets the application create, update, and delete records on those tables from within the application scope.

2. Update Configuration Properties

When you have run the script, do the following:

  • Navigate to Configuration properties.
  • Select the checkbox for Will attempt to auto-create related artifacts if set to true.
  • Select Save.

This sets the x_lomo_dx.config.artefactAutoCreation property to “true” (false by default).

Result

Following these steps, LMDX creates a new Business Rule record for the selected table, each time a new Config record is created. If domain separation is enabled, the Business Rule will be in your primary domain.

If the selected table is not part of the CMDB hierarchy, LMDX will also create:

  • A new Table extending Import Set Row (sys_import_set_row).
  • The following Dictionary records for the new import set table:
    • Coalesce type.
    • External reference.
  • A new Table Transform Map for the new Table.
  • A Field Map for the sys_id field.
  • An onAfter Transform Script (used for LMDX processing purposes).

If the selected table is not part of the CMDB hierarchy and domain separation is enabled, LMDX will also create:

  • A Dictionary record for the new import set table:
    • Domain.
  • A Field Map for the domain field.

Creating Artifacts Manually

If you do not want to run the automation script on your instance, you can manually create the required artifacts for data synchronization to a new table. An Outbound Transform Map is always created automatically whenever a new Config record is created.

Before you start creating artifacts, do the following:

  • Ensure that the checkbox for Will attempt to auto-create related artifacts if set to true… on Configuration properties is deselected. The system property x_lomo_dx.config.artefactAutoCreation will then be set to “false”, indicating that artifacts are created manually.
  • Ensure that you are creating your artifacts within the LogicMonitor Data Exchange (x_lomo_dx) application scope. For more information on how to select a specific application, see the ServiceNow documentation.

Inbound Artifacts

Follow these steps to create the artifacts:

  1. Create a new Table that extends Import Set Row (sys_import_set_row).
  2. Create two fields string fields on the new Import Set Table with the labels:
    • Coalesce type
    • External reference
  3. Create a new Transform Map (sys_transform_map). For more information, see the ServiceNow documentation.
  4. Create a field map on the new Transform Map. Ensure it is mapped to the target table’s Sys ID (sys_id) field, tick the “Use source script” and “Coalesce” checkboxes, and copy the script from the existing sys_id field map from the preexisting Incident Transform Map (LMDXDefaultInc). For more information, see the ServiceNow documentation.
  5. Create an onAfter Transform Script and copy the onAfter Transform Script from the preexisting Incident Transform Map.
  6. Additional steps for domain separated instances:
    • Create a string field with label “Domain” on the new Import Set Table.
      LMDX domain seperated option
    • Create a field map on the new Transform Map. Ensure that the newly created Domain (u_domain) field on the Import Set Table is mapped to the target table’s Domain (sys_domain) field.
      LMDX transform map option

Outbound Artifacts

Follow these steps to create the artifacts:

  1. Create a Business Rule by copying the existing “LMDXDefaultInc Sync” on the Incident table to your SN table.
  2. For domain separated instances: Ensure the Business Rule is in the primary domain of your instance. For more information, see the ServiceNow documentation.
In This Article