How to import data with related list records

Steveanner
Tera Contributor

Hello Community,

 

we are trying to import the data from one personal dev instance to other, But we are facing some issue here.

We have lot of records in instance A having records with related list records .Can anyone have any idea how to import with related list records as well?

 

Thanks,

Steve An

8 REPLIES 8

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

You can add Transform Scripts to your Table Transform Map.   Add an 'onAfter' script to your map.   This functions just like an onAfter business rule.   But you won't have a 'current' context.   Instead you have a 'target' context.   Each time you insert a row into the target   via the transform, the onAfter script will run.

 

The script can insert records into your related table. Simply set the reference field on the related record to the sys_id of the record that's been inserted by the transform map   (target.sys_id).

 

Please mark my answer as correct/helpful based on Impact.

Thanks for the quick reponse Sourav can you provide us sample script it would be great help and we can try with this approach ?

 

Thanks,

Steve An

Hello,

 

Giving a second thought maybe script is not a good way to do it as you may have a lot of record which you will have to hard core. If you have only two tables then do the following:-

 

Taking Incident table as an example:-

 

Export the data from incident table

 

Saurav11_0-1665388723045.png

 

And then import it on the Incident table of your other instance as below:-

 

Saurav11_1-1665388792362.png

 

Now if the related list is Incident task you do the the incident task table do the same. Due to the reference field it will automatically come under the related list in the new instance.

 

Please mark my answer as correct/helpful based on Impact.

 

ersureshbe
Giga Sage
Giga Sage

Hi,

Can you try export as xml file and import in your target instance? If it one time activity, export and import is enough. anyway you are going to do the Clone activity it will manage the instance sync.

If you need dynamic way, you should write the script to move the data.

Regards,

Suresh.

Regards,
Suresh.