How to use single transform map to transform data on different tables ?

Siddhesh Gawade
Mega Sage
Mega Sage

Hello,

I am using following approch to avoid creation of many transform maps for different lower-level tables

Create a field map of "Class" field (sys_class_name) where I can define the backend table name of each class, e.g.: 'cmdb_ci_esx_server' or 'cmdb_ci_server' and this should present in source file (csv or excel). Using the above approach I  can build  transform on the "cmdb_ci" table instead of individual class tables.

 

However, with that approach, product models are getting duplicated. . also I don't want to relying on the higher level (cmdb_ci) but on individual lower-level tables e.g. cmdb_ci_esx_server, or cmdb_ci_mfp_printer.

If anyone could find a solution so I do not have to create transform map for each lower level table.

Regards,

Siddhesh

6 REPLIES 6

Allen Andreas
Administrator
Administrator

Hi,

Unfortunately, a single transform map can only be pointed to one target table. So while you can point to a parent table and create records with a specific class to sort of drop them into the child tables, as you've seen, you won't have access to those child specific fields, directly, like in the field mapping.

What you could do is create an onAfter script that goes in and then update the values in those child tables, but you'd have to build the mapping and evaluate the table from source record and then go from there. So it's a round about way that has some technical debt to it.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hello @Allen Andreas ,

Thank you for your reply,

Can you please guide how I can use onAfter script or if possible can you provide script ?

Regards,

Siddhesh

Hi,

Please see the below reply regarding Robot Import Set Transformers and see if that works for you.

As far as the above, if it's still needed after reviewing the below, you can certainly attempt and we can work from there on a script. I'm not going to provide a script up front as that's not how I usually do things on the forums.

I will provide this documentation though, which has explanations and examples: https://docs.servicenow.com/en-US/bundle/sandiego-platform-administration/page/script/server-scripti...

Please mark reply as Helpful, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

User511834
Tera Expert

The answer for this is to use Robust Import Set Transformers. Robust import set transformer requires only a single read operation to prepare the data for two or more target tables. See further information in the documentation below:

https://docs.servicenow.com/en-US/bundle/sandiego-platform-administration/page/administer/import-sets/concept/robust-import-set-transformers.html