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

Okay.

In the green section  (out of 4 columns in your XLS)  is there any 1 column data unique which can help us to identify that record in SN to fetch the TC number?

Hi Asifnoor,

 

In the green section which I am loading into Test Case table (using TC_number (Is a test plan - name)) 

we can identify with TC_number i.e., test plan name which will be in test case table as reference

and Test Plan is the field name in TEST CASE STEPS table for TC_number

*** from test case table if possible we can Use Test Scenario field from Green section.

which will be using to sort

 

Thanks,

Lean S

 

asifnoor
Kilo Patron

Hi 

creating new thread.

Can you run this script in your background and share me the outtput. Based on this we can decide the source script.

var gr = new GlideRecord("tm_test_case_instance");
gr.addQuery("short_description","TEST ABC"); //put right value and field that is unique if this is not.
gr.query();
gs.info("No. of rows are "+gr.getRowCount());
if(gr.next()) {
  gs.info("Sys id is "+gr.sys_id.toString()+"---"+gr.number);
}

Hi,

Thanks for that.

please find below:

I have used Test plan as reference in the code: 

as I am using test plan name as reference and it is Short description field. so below code I used

var gr = new GlideRecord("tm_test_case_instance");
gr.addQuery("tm_test_plan.short_description","TEST ABC"); //put right value and field that is unique if this is not.
gr.query();
gs.info("No. of rows are "+gr.getRowCount());
if(gr.next()) {
gs.info("Sys id is "+gr.sys_id.toString()+"---"+gr.number);

}

 

output:

find_real_file.png

 

In the green coloured section, I used Test scenario also and below is the output:

 

var gr = new GlideRecord("tm_test_case_instance");
gr.addQuery("u_test_scenario","TCTEST "); //put right value and field that is unique if this is not.
gr.query();
gs.info("No. of rows are "+gr.getRowCount());
if(gr.next()) {
gs.info("Sys id is "+gr.sys_id.toString()+"---"+gr.number);
}

 

Output:

find_real_file.png

 

Thanks,

Lean S

Hi

As per 1st output, we have 53 rows. so it is not unique through which we can identify a test case number.

In the 2nd output, we got 2 rows. Can you tell me if the test case number is same for these 2 rows or different?