Import data into several tables with relationships

michael_oporkov
Kilo Contributor

Hello,

I need to implement the import of external data into two ServiceNow tables with relations between them like groups and users. In other words items from the second table are members of items from the first one. Now I'm trying to figure out the best way to do this. 

The question is if I can achieve my goal with Import Sets?

More specific: If I create the third table keeping the membership between two import set tables is there a way to keep this relation after loading all the data into main tables? 

What is the best practice for implementing such tasks?

Thanks in advance!

 

1 ACCEPTED SOLUTION

Sabrina10
Kilo Guru

Can an item in Table 2 belong to more than one item in Table 1?

If so, then you do want 3 tables. 

Table 1

Table 2

Table 3 = many to many table with a reference field to each table. 

 

During your import, you can use an onAfter Transform Script to create the entries in Table 3.   I find this article helpful with building Transform Scripts

http://www.john-james-andersen.com/blog/navigating-transform-scripts-in-servicenow.html

 

View solution in original post

1 REPLY 1

Sabrina10
Kilo Guru

Can an item in Table 2 belong to more than one item in Table 1?

If so, then you do want 3 tables. 

Table 1

Table 2

Table 3 = many to many table with a reference field to each table. 

 

During your import, you can use an onAfter Transform Script to create the entries in Table 3.   I find this article helpful with building Transform Scripts

http://www.john-james-andersen.com/blog/navigating-transform-scripts-in-servicenow.html