Upload data in bulk

Khanna Ji
Tera Guru

Hi Team,

 

I have a scenario where the user will provide me a short description of the incident, a short description of the incident task, short description of patch task and CI. I have to create multiple records in the system.

 

Incident - Parent record

 ==> Incident Task - Child to the Incident record and must be related to the Incident

====> Patch task - Child to the Incident task record and must be related to the incident task.

 

Here we have Parent, child and sub-child to be created and associated respectively. How can we achieve this?

 

Incident SDIncident Task SDCI on Incident TaskPatch Tasks
Operating System PatchWindows 10Computer1Operating System Patch - Windows 10 - Computer1
Operating System PatchWindows 11Computer2Operating System Patch - Windows 10 - Computer2
Operating System PatchLinuxComputer3Operating System Patch - Windows 10 - Computer3
System UpgradeWindows 10Computer1System Upgrade - Windows 10 - Computer1
System UpgradeWindows 11Computer2System Upgrade - Windows 10 - Computer2
System UpgradeLinuxComputer3System Upgrade - Windows 10 - Computer3
1 REPLY 1

Ratnakar7
Mega Sage
Mega Sage

Hi @Khanna Ji ,

 

One way to achieve this is to use the ServiceNow Import Set Table API. You can create a CSV file with the necessary data for each record (incident, incident task, and patch task), and then use the Import Set Table API to upload the data in bulk.

Here are the high-level steps:

  1. Create a CSV file with columns for incident short description, incident task short description, CI name, and patch task short description.
  2. Use the Import Set Table API to create an import set table for each of the three tables (incident, incident task, patch task).
  3. Upload the CSV file to the corresponding import set table using the Import Set Row API. This will create records in the import set table.
  4. Use a script to transform the data in the import set table and create the necessary records in the incident, incident task, and patch task tables. This script can run automatically when records are uploaded to the import set table using the Business Rule script.

In the script, you can use GlideRecord to create new records in the incident, incident task, and patch task tables. You can set the values for the short description, CI, and other fields based on the data in the import set table. You can also use GlideRecord to set the parent-child relationships between the records.

Once the records are created, you can use the sys_id values to link the incident, incident task, and patch task records together using GlideRecord.

 

Also, refer Import Set API and Import Set - API (blog-post) 

 

Thanks,

Ratnakar