Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

i have sam requirement where when user will submit the catalog item for bulk import the license key

KAkanksha15
Tera Contributor

The requirement is to create a catalog item that allows users to perform a bulk import of license key data into the samp_sw_license_key table. When the user submits the catalog item with the bulk upload file, the system should validate the data before loading it into the target table.

As part of the validation, the system should check for duplicate license keys and identify any other errors encountered during the import/transform process. Records with valid data should be loaded into the target table, while duplicate or invalid records should not be created.

After the import process is completed, all error details, including duplicate license keys and other validation or transformation errors, should be captured and sent to the requester through a notification. The notification should provide sufficient details to identify the records that were not successfully processed.

1 REPLY 1

pr8172510
Kilo Sage

Hi @KAkanksha15 ,

This can be implemented using the Import Set/Transform Map framework with a staging layer before inserting records into samp_sw_license_key.

  1. Create a Catalog Item with an attachment variable for the bulk license-key file.
  2. Load the uploaded file into a staging/import-set table rather than directly into samp_sw_license_key.
  3. Use a Transform Map to validate each row before creating the target record.
  4. Validate:
    • Mandatory fields
    • Valid Software Entitlement
    • Duplicate license keys within the uploaded file
    • License keys that already exist for the same entitlement
  5. For valid rows, create records in samp_sw_license_key.
  6. For invalid/duplicate rows, skip the target record and capture the row number, license key, and error reason.
  7. After the import completes, generate an import summary containing:
    • Total rows
    • Successfully imported
    • Failed/duplicate rows
    • Validation/transform errors
  8. Send the summary to the requester through a notification, including enough information to identify and correct the failed rows.

 the License Key must be unique for an entitlement, so the duplicate validation should be performed against existing license-key records as well as duplicates within the uploaded file.

Flow

Catalog Item → Attachment → Import Set/Staging → Validation & Duplicate Check → Transform → samp_sw_license_key → Import Summary → Notification


 keep the validation in the staging/transform layer rather than inserting directly into samp_sw_license_key, so invalid records never get created.