Can I insert into multiple tables using a single Transform Map?

ServiceNowSteve
Giga Guru

Long story short: I have data that needs to make records on multiple tables but it's all given to me in a single excel sheet.

Can I make the TM somehow say "Column A" goes to this table, "Column B" to this table and so on?

1 ACCEPTED SOLUTION

Steve McCarty
Mega Guru

Depending on the data, it may be easier to do multiple transforms on the same data source.  Each transform map would point to a separate table.  You can set an order value to the transform maps so that they run in a particular order.  Then if they run on a schedule, you would import the data and then it would run through all the rows for the first transform map and then the second and continue on for however many transform maps you set up for the data.

View solution in original post

8 REPLIES 8

sachin_namjoshi
Kilo Patron
Kilo Patron

Yes, you can write transform script to insert 1 records into multiple tables.

 

https://docs.servicenow.com/bundle/jakarta-platform-administration/page/script/server-scripting/concept/c_TransformMapScripts.html

 

 

 

Regards,

Sachin

ServiceNowSteve
Giga Guru

Thanks, I am aware of Transform scripts but I guess I need an example of how to tell it where to go? Because on the Transform map itself it says to provide a "Target Table" so wouldn't everything go there?

you can use script part in transform map to insert data into multiple records

 

 

Please check below example

 

var t1 = new GlideRecord('t1');

t1.initialize();

ti.a = source.column_a;

ti.insert();

 

var t1 = new GlideRecord('t2');

t2.initialize();

ti.b = source.column_b;

ti.insert();

Steve McCarty
Mega Guru

Depending on the data, it may be easier to do multiple transforms on the same data source.  Each transform map would point to a separate table.  You can set an order value to the transform maps so that they run in a particular order.  Then if they run on a schedule, you would import the data and then it would run through all the rows for the first transform map and then the second and continue on for however many transform maps you set up for the data.