Upload data in bulk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2023 04:21 AM
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 SD | Incident Task SD | CI on Incident Task | Patch Tasks |
Operating System Patch | Windows 10 | Computer1 | Operating System Patch - Windows 10 - Computer1 |
Operating System Patch | Windows 11 | Computer2 | Operating System Patch - Windows 10 - Computer2 |
Operating System Patch | Linux | Computer3 | Operating System Patch - Windows 10 - Computer3 |
System Upgrade | Windows 10 | Computer1 | System Upgrade - Windows 10 - Computer1 |
System Upgrade | Windows 11 | Computer2 | System Upgrade - Windows 10 - Computer2 |
System Upgrade | Linux | Computer3 | System Upgrade - Windows 10 - Computer3 |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2023 12:41 AM
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:
- Create a CSV file with columns for incident short description, incident task short description, CI name, and patch task short description.
- Use the Import Set Table API to create an import set table for each of the three tables (incident, incident task, patch task).
- 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.
- 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