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

anurag92
Kilo Sage

Robin, Better approach would be as Sahitya Suggested. Once you add all 50 servers in system, prepare another sheet for relationships between child and parent CIs, create a transform map on cmdb_rel_ci table and load this sheet. This might add an extra step, but is less riskier/difficult than creating a transform script.



Let me know if this helps.


Thanks for your help sahithya.


suppose for all the servers ,child CI should be the same.


as you suggested in the above steps,how to load the excel sheet (contains information of all about 50 servers)under the data source.


Navigate to System import sets-->load data specify the details such as details of staging table,file to imported


1.png


then create a 2 transform maps one for importing data to cmdb_ci_server table and other for importing data to cmdb_rel_ci table


t1.png



t2.png


the order is important.