OBLYTECH Logo
OBLYTECH Logo

Data Lookup Rules for Imports

ServiceNow data lookup rules set field values by matching a record against a lookup table. Run on insert fires when a user creates a record, and Run on update fires when a user saves one. The documentation does not say whether an import run fires these events, so confirm it with a test import before relying on it. Assignment lookups route incidents; custom lookups support other field combinations, with explicit matching and replacement settings.

Plan ServiceNow data lookup rules around the target record

Start with a written decision: which incoming values should produce which final values? A lookup separates the inputs used for matching from the outputs it supplies. Matcher fields identify a lookup row. Setter fields provide the values to write. This makes a routing matrix easier to review than a collection of unexplained exceptions.

For an incident assignment lookup, the available matching fields are Category, Subcategory, Configuration item, and Location. The assignment outputs are Assignment group and Assigned to. A valid assignment lookup needs at least one matcher and one setter. Use that narrower configuration when incident routing is the requirement; consider a custom lookup when the required inputs or outputs differ.

Before configuring anything, list the destination table, matching fields, expected outputs, and whether an existing value should survive. Include blank inputs and prepopulated outputs in that list. For the wider import design, use the data migration and import sets guide to organize the surrounding work.

The steps below follow the Brazil release. Menus and options can differ on other releases, so check them on your instance. Treat the test matrix as an acceptance record: it should explain why each sample record received its final assignment or other derived value.

Keep the matcher table in the definition scope

A custom data lookup table stores the values used to match a target record and the values returned by the rule. Its rows must be unique. When creating a definition, choose the target Source Table and the Matcher Table separately: the first contains fields to update, while the second contains the lookup values. The matcher table name must begin with u_, and the table or database view must be in the same scope as the definition. Check scope before investigating a missing table in the selection list.

Create an incident assignment lookup

Creating an assignment data lookup rule requires assignment_rule_admin or admin. Prepare the intended group and user values before starting so the rule can be reviewed as a complete input-to-output decision.

  1. Navigate to All > System Policy > Rules > Assignment Lookup Rules.
  2. Select New.
  3. Fill in the relevant Category, Subcategory, Configuration item, or Location matcher fields.
  4. Set Assignment group, Assigned to, or both, according to the intended routing.
  5. Set Active to control whether the rule runs, and review Order against other matching rules.
  6. Select Submit.

The Data Lookup Plugin uses the rule with the lowest order and matching values. Review overlapping rules before testing: a rule that looks correct in isolation may not be the rule selected for a particular incident. Give reviewers a sample input and the expected winning rule rather than asking them to approve the rule name alone.

For a proposed category-and-location routing decision, prepare incidents that meet both conditions and incidents that differ in one condition. Record the resulting group and user separately. A correct group does not establish that the individual assignment also met the acceptance criteria.

Build a custom lookup when the assignment fields do not fit

A custom data lookup table must extend Data Lookup Matcher Rules [dl_matcher]. Its columns hold both matcher data and setter data, and its rows must be unique. Design those columns around the decision you need to express. Avoid adding outputs simply because they might become useful later.

Adding lookup values requires admin. Open the custom table through the navigation filter, configure its fields, and create rows containing the intended matcher and setter values. Review the rows as a complete matrix before connecting them to a definition. A definition cannot compensate for incorrect values in its matcher table.

Creating the definition also requires admin. Navigate to All > System Policy > Rules > Data Lookup Definitions, select New, then select Data Lookup Rule. Enter a unique Name, select Source Table, select Matcher Table, and configure Active and the required run events.

Source Table is the table whose fields will be updated. Lookup definitions do not pass down to child tables. A definition written against Task will not match Incident records, so set Source Table to the table that actually holds the fields being updated. Matcher Table supplies the lookup values and must be available within the relevant scope.

Save the definition through the form header, then add Matcher Field Definitions and Setter Field Definitions. In each mapping, distinguish the destination field from the lookup-table field. Submit the individual definitions and select Update on the parent definition when the configuration is complete.

Choose matching and replacement behavior explicitly

Under Matcher Field Definitions, Source table field identifies the input on the target record, while Matcher table field identifies the corresponding lookup column. Data lookup occurs on fields with matcher definitions. Journal type fields are not supported for this matching.

Exact lookup match changes how blank matcher values behave. With it selected, the matcher table needs a matching combination, including empty values. With it cleared, an empty value in a matcher row acts as a wildcard. Review blank cells as part of the routing logic, rather than treating them as unfinished data.

Under Setter Field Definitions, Source table field identifies the field to update and Matcher table field provides its new value. Tick Always replace on a setter to let the lookup overwrite a value the field already holds. With it cleared, the lookup leaves a populated field alone. Decide this per setter, especially when incoming records already contain assignments.

Write down which source owns each output before enabling replacement. If that decision is disputed, resolve it before expanding the rollout. A ServiceNow implementation engagement can be scoped around the lookup matrix, field ownership decisions, and acceptance cases needed for that review.

Test insert and update paths separately

Run on form change fires when someone edits a source field on the form, or when an onChange client script edits it. Run on insert looks up values when a record is created. Run on update applies when a record is saved or updated. Select events that match the required behavior, then verify them through the intended import process.

A form test demonstrates the form path. Add a separate imported-record test before accepting the configuration. Use the transform map and duplicate prevention guide for the surrounding record-matching design, and keep lookup acceptance focused on the derived field values.

  • Test a new target record with matching inputs and blank setter fields.
  • Test an update with matching inputs and existing setter values.
  • Test blank inputs against the chosen exact-match setting.
  • Test a combination without a corresponding lookup row.
  • Test overlapping assignment rules and the expected Order outcome.

Capture input values, the selected lookup row, replacement settings, and final stored values for each case. Agree on the expected outcome before running the test. Otherwise, an unexpected result can be mistaken for acceptable behavior simply because the import completed.

Trace conflicting values through rule execution

For database operations, before business rules with an order below 1000 run before the before engines. That engine group includes assignment rules and data lookup inserts or updates, and its engines have no specified execution order relative to one another. Before business rules with an order of 1000 or greater follow that engine group.

Do not use assignment-rule ordering as evidence that the assignment engine runs before the data lookup engine. Those are different ordering questions. When a value changes unexpectedly, identify the configured writers and inspect their conditions before changing the lookup matrix.

Data lookup and assignment rules can coexist. Once an incident has an assignment, a second matching rule has no effect unless that setter has Always replace ticked. Check both the existing assignment and replacement option when a second rule appears to have had no effect.

A form-change lookup does not run just because another data lookup rule changed a field. A user cannot change a read-only matcher through the form, but a client script can still trigger the form-change event for a read-only field. When activating Data Lookup and Record Matching Support, check whether custom priority logic needs to be recreated because the plugin replaces the calculatePriority rule without copying custom code.

Also check for recursive dependencies, such as one lookup changing a field that another lookup uses to change the first field. Verify that the intended matching row exists, including blank-value combinations when exact matching is enabled.

For broader diagnosis, follow the import troubleshooting guide. Keep a failing sample small enough to compare its matcher values, lookup row, and final outputs without unrelated changes obscuring the result.

How coalesce fields decide between updating and inserting a row

Coalesce fields decide whether an incoming row updates an existing record or inserts a new one. A repeat load stays free of duplicates when the coalesce fields hold a stable identifier that the source system does not change between runs. Settle the key first, then test it by running the same file twice before accepting the load.

What the coalesce fields decide on each row

Each row’s coalesce values are checked against the target table. A matching row updates that record, and a row with no match creates a new one. Non-unique values can merge records that should stay separate. A blank coalesce value needs its own rule, because a blank cannot identify a record.

Choose a key that does not change between loads

A key only works if the same source record produces the same value every time the file is loaded. Build the coalesce value from a stable source-system identifier plus the original record key. Treat these as weak keys:

  • Display names, titles and descriptions, which people edit after the first load.
  • Email addresses and other contact values that change when a person changes role.
  • Identifiers with leading zeros or mixed formatting, which the import has to treat explicitly.
  • Values that are not unique in the source, so two different records share one key.

Run the repeat-load check before accepting the mapping

  1. Load the file into an empty target table and record the row count and the number of inserts.
  2. Run the identical file again without changes. Expect zero new records and an update for every valid row from the first load.
  3. Edit one non-key field in the source file, reload it, and confirm that only that field changed on the existing record.
  4. Query the target table for duplicate coalesce values and confirm the result is empty.
  5. Load a file that contains blank key values and confirm the agreed rule for them: reject, quarantine, or insert once.

What to compare after each run

After each rerun, compare the target row count before and after, the insert and update counts in the load log, and the number of rows sharing a key. A rerun that adds rows has failed, even when the import reports success.

What to ask for before approving the coalesce design

  • A written list of the coalesce fields for each destination table, with the source column that feeds each one.
  • A sample of matched and unmatched rows showing which record each row updated, or why it inserted.
  • The rule for blank and duplicate key values in the source file.
  • Whether reference fields can create missing referenced records during the load, and how the design handles it.