Does anyone have examples of transform scripts they have used to import multiple CI classes into the CMDB that they are willing to share?

jamestrezza
Giga Contributor

I have over 40 different CI classes that are in flat file format that need ongoing import to the CMDB and want to avoid having one import/transform per CI Class.

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

Michael.Fry solution is probably the simplest, BUT make sure that the value for the sys_class_name is valid or you will mess things up real quick (typos will kill you).   You could add something like this to the end of Michael's script in order to validate the data before it's inserted:



var test = new GlideRecord(target.getValue("sys_class_name"));


if (!test.isValid()) {


      ignore = true;   //will skip this one row


      gs.addErrorMessage("whatever message you want to add to the logs, if any");


}



It just tries to create a new record (will not actually save it though) and then checks to see if the record is valid.


View solution in original post

10 REPLIES 10

Your transform map target table can only be 1 table. So choosing Windows table, that's the table where all the records will import into.


But if you choose the top table, cmdb_ci and use the IF script, you can route to appropriate extended table based on some variable in your import data.



You could try adding class in your field mappings, but not sure it will find the right table based on import data. Worth a try.