how to import data to two tables in a single transform map?

Manikantahere
Tera Contributor

I do have a requirement to import data into two tables i.e. one to software model and another is business application.

while importing most of field values are moved to software model and some were moved to business application as new records.

 

how to process this and I need to maintain relationship between these records.

example:  The software model should be reference field value inside Business application.

3 REPLIES 3

raj chavan
Tera Guru

hi @Manikantahere 

Include a unique identifier (e.g., `External ID`) in your source data to link both tables

Use Import set and Transform Map to load data into the `Software Model` table.
   have unique field (e.g in `u_external_id`)
 
Use another Import Set and Transform Map for the Business Application table.
Add a script in the Transform Map to link the `Software Model` reference

 

 var softwareModel = new GlideRecord('cmdb_software_product');
     softwareModel.addQuery('u_external_id', source.u_external_id);
     softwareModel.query();
     if (softwareModel.next()) {
         target.u_software_model = softwareModel.sys_id; // Reference field
  }

 

 

 

 

Kindly mark it correct and helpful if it is applicable.

Thanks,

Raj

Simon Christens
Kilo Sage

You can make 2 transform maps on the same import table.

1st transform map ensures that the Software Model is created / updated
2nd transform map creates / updates the Business Application - then you can look up the Software model from the name of the model in you import table - because it should exists if the transform map maintaining Software models runs before the Business application transform map.


Transform maps have order - order 100 runs before order 200 etc. - it should be fairly straight forward.

 

Hopefully it helps. 

PrashantLearnIT
Giga Sage

Hi @Manikantahere 

 

You can try to utilize Robust Transform Maps to fulfill this requirement.

********************************************************************************************************
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.

********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect


Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************