How to to import data from an excel sheet having multiple tabs into multiple tables in ServiceNow?

Sue16
Kilo Contributor

I have an excel sheet with multiple tabs/sheets that contain test cases. I need to import the excel sheet into ServiceNow such that a Test Plan gets created and test cases present inside the excel sheet get inserted into the tm_test_case_instance table (in the related list of Test Plan). I need to import such that few fields like "Test Steps", "Expected Results", "Status" should be created inside the related list "Test" table and the remaining fields of that excel into the parent "Test Case" table. All the test cases present inside one excel file should be inserted in a single "Test Plan".

So, I need to import data from an excel sheet having multiple tabs into multiple tables in ServiceNow (Tables are --> Test Plan (Parent), Test Case (in the related list of TestPlan), Test (which is Test Steps in the related list of Test Case).

If anyone can provide the approach/ Link on how to proceed with this requirement, will be helpful.

5 REPLIES 5

Khalnayak
Tera Guru

Sue16
Kilo Contributor

Hi @Usmaan 

I have tried, I somehow figured I need to create one source table and two transform maps (one for Test Case & other for Test Step). Inside Test Case transform Map, I created the linkage for Test Plan ( Test Plan is created and Test case gets linked to it) and inside Test Step Transform Map, the linkage between Test Case and Test Step form is made. This linkage can be made by populating the reference field (test plan & test case reference fields on respective tables). But I was unable to create this linkage (like how to populate Test case reference field inside Test Table (test step) with Test Case Number).

There are 3 tables where I need to populate the data from the excel sheet. Few columns need to be populated into the Parent table & other into the related list table. So, once the data is populated into the respective table via a transform map, The child records are not linked inside the Parent table because the reference field of the Parent table inside the child table form is not getting populated via a transform map because all the tables are created simultaneously.

Can you please suggest here?

MukeshP203
Tera Contributor

i have the same requirement. Can you provide the solution?

 

Hello @Sue16 ,

Kindly write a on complete transform map script on the both the child transform map to get the parent in the child records.

The script will look like below:
var grint = new GlideRecord('intermediate table');

grint.addQuery('sys_import_set', source.sys_import_set);

grint.addQuery('row',source.row);

grint.query();

if(grint.next()){
source.parent = grint.target_record;
source.update();
}

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.