how to import data to two tables in a single transform map?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 01:56 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 02:29 AM
Include a unique identifier (e.g., `External ID`) in your source data to link both tables
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
}
Thanks,
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 02:45 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 03:30 AM
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
********************************************************************************************************