how to populate the cmdb_rel_ci table while importing the CI's in to cmdb_ci_server table

robinpaul
Kilo Contributor

Hi,

I need to add 50 rows ( 50 new servers in an excel file ) into the cmdb_ci_server table(target table).while importing   these servers , i need to add the relation ship between these 50 new servers with the another CI's in the   cmdb_ci_service(Business services table) .

relationship should be like this:

parent CI:linux01 server

child CI :Retail Adding Points (Retail Adding points is the CI name in the business services class)

relatin type : Depends on::Used by

so , i need help for writing the transform map script for this requirement.

Thanks in advance ....

1 ACCEPTED SOLUTION

sahitya3
Kilo Expert

Hi Robin,


Is the child ci same for all the 50 new server's ?? if so you can directly


1)create a new   transform map under data source


2)target table as cmdb_ci_rel


3)change the order to 200


4)using mapping assist map the parent to ci name


5)write the following script


(function transformRow(source, target, map, log, isUpdate) {




  // Add your code here


  target.child="your business service";


  target.type="Depends on::Used by";




})(source, target, map, log, action==="update");



Regards,


Sahitya


View solution in original post

7 REPLIES 7

sahitya3
Kilo Expert

Hi Robin,


Is the child ci same for all the 50 new server's ?? if so you can directly


1)create a new   transform map under data source


2)target table as cmdb_ci_rel


3)change the order to 200


4)using mapping assist map the parent to ci name


5)write the following script


(function transformRow(source, target, map, log, isUpdate) {




  // Add your code here


  target.child="your business service";


  target.type="Depends on::Used by";




})(source, target, map, log, action==="update");



Regards,


Sahitya


anurag92
Kilo Sage

Is the Child CI static? or does it change according to the parent CI?


Thanks for reply..


child CI   should be different for every parent CI.


Is it possible


Hi Robin,


on what basis they are related?


do you have it in the excel file that shows which server should be mapped to which business service or


do you have some conditions based on which they have to be related?