- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2017 01:57 AM
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 ....
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2017 02:46 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2017 03:14 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2017 03:33 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2017 04:32 AM
Navigate to System import sets-->load data specify the details such as details of staging table,file to imported
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
the order is important.