The CreatorCon Call for Content is officially open! Get started here.

Load one excel for multiple tables

Lean S
Mega Expert

Hi All,

I am working on import sets and transform maps. I wanted to load one excel sheet for loading in multiple tables.

This is for loading into test case and related test case steps instance

Under test plan I have to load test cases as first step and second I have to map to test case -> test case step

so from one excel sheet 

test plan -> I have load test cases

test case -> to load its related test case steps.

How can achieve using one excel sheet. Any specific coding needed for this.

 

Thanks,

Lean S

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

From single excel file you can transform data to multiple target tables.

I assume you must be having a data source to which this excel would be attached

Define the transform maps accordingly in sequence with the Order for those target tables

1st load the Test Plan

2nd Load the Test case

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

49 REPLIES 49

Hi,

I am attaching an sample sheet, which contains records in green and yellow. Green coloured fields I am using to load on to test case table (test cases are under test plan) (1st transform map) and Yellow coloured ones mapped in 2nd for test case instance table 

Let us say 2 records created 2 test cases (TMTC0001 & TMTC0002) and now automatically we have create records for this in Test case instance table under this 2 records. 

 

find_real_file.png

Thanks,

Lean S

Okay.

IS the TP Number stored in your test case table and is it unique per test case?

If yes, then you can use that to query the test case sys_id and link it to the 2nd table.

Map TP Number with this column tm_test_case_instance in your 2nd transform map. Then click on that TP Number field and enable source script and add below code.

var gr = new GlideRecord("sn_test_management_test_version");//MENTION test case table
gr.addQuery("tp_number",source.u_tp_number); //Put correct field names
gr.query();
if(gr.next()) {
  source.u_tp_number=gr.sys_id.toString(); 
}

 

Hi,

I think I am buzzing lot of times, but I have made a simple flow which needs to be done using transform map:

find_real_file.png

 

find_real_file.png

I have used above in Source script but no luck. Can you please suggest for this.

 

Thanks,

Lean S

 

Hi,

Yes, it should work as per the flow that you have mentioned. 

Kindly answer these questions.

1. Is TP numbers stored in your test case table or not?

2. In the 2nd transform map, did you map the TP number with the tm_test_case_instance ?

3. Share the latest source script that you have.

Kindly mark the comments as helpful if they are helping to debug.

Also, let me know if you are on zoom where we can look into the issue together.

Hi Asifnoor,

Thanks for the reply.

I have checked below:

1. Yes TP_number is stored in TEST CASE table

2. In the 2nd transform map (Test Case Step table (test)), do you mean to say mapping TP_number to Test Case steps table. find below screenshot

find_real_file.png

 

Source field now changed to TC_number (test plan number) but data is same as previous. 

 

3. Plz find below source script:

find_real_file.png

 

tm_test_case_instance is the TEST CASE table value. A small question here do I need to do same as in 2nd point to map TC_number to TEST case field and select use source script checkbox to true?

Please suggest.

 

And Sorry I am not on Zoom. 

 

 

Thanks,

Lean S