- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2016 12:19 PM
I am trying to import some records into cmdb_ci table. My excel sheet does have a column Class=Computer. But in transform map, when I do an Auto mapping.. I could not find the sys_class_name field in my target table. So, in the run script block, I wrote the following assuming it will update the Class along with other columns.
target.sys_class_name = source.u_class; //Did not work -------------need help
To be more accurate, I updated my excel file to have values 'cmdb_ci_computer' for Class column.
But, it does not take this value. It shows the Class as 'Configuration Item'
Need help please.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2016 12:31 PM
Unless someone has a clever solution, I always import CIs class-by-class, your issue being one of the reasons; sys_class_name is set by the system automatically based on the target table you pick.
Hope this helps.
Please feel free to connect, follow, mark helpful / answer, like, endorse.
John Chun, PhD PMP ![]() | ![]() |
Winner of November 2016 Members' Choice Award
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2016 12:31 PM
Unless someone has a clever solution, I always import CIs class-by-class, your issue being one of the reasons; sys_class_name is set by the system automatically based on the target table you pick.
Hope this helps.
Please feel free to connect, follow, mark helpful / answer, like, endorse.
John Chun, PhD PMP ![]() | ![]() |
Winner of November 2016 Members' Choice Award
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 10:24 AM
It is possible to use the transform map to set the class type. The transform map in my example has the target table set to cmdb_ci_server and the script associated with the transform map uses columns defined in the data source (in this example called product and operating_system) to select the most appropriate target class.
The only restriction that I found when performing this type of "upgrade" class operation is that the field mapping will only support the "BASE" class attributes (in my case cmdb_ci_server attributes) and not those in the derived classes.
---SNIP---
var devType = source.u_product.toString().toUpperCase();
var operating_system = source.u_operating_system.toString().toUpperCase();
if (devType == "WINDOWS SERVER"){ target.sys_class_name="cmdb_ci_win_server"; }
else if (devType == "UNIX"){
if (operating_system == "HP-UX"){ target.sys_class_name="cmdb_ci_hpux_server"; }
else if (operating_system.match(/SUNOS/i) != null){ target.sys_class_name="cmdb_ci_solaris_server"; }
else if (operating_system.match(/AIX/i) != null){ target.sys_class_name="cmdb_ci_aix_server"; }
else if (operating_system.match(/LINUX/i) != null){ target.sys_class_name="cmdb_ci_linux_server"; }
else {target.sys_class_name="cmdb_ci_unix_server"} //just unix
}
else if (devType.match(/NETWARE/i) != null){ target.sys_class_name="cmdb_ci_netware_server"; }
else if (devType.match(/DARWIN/i) != null){ target.sys_class_name="cmdb_ci_osx_server"; }
Andy Trayler
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2018 07:30 AM
target.sys_class_name="cmdb_ci_hpux_server"; worked for me.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2018 09:08 AM
I performed a simple import, containing two server classes (Windows and Linux) into the cmdb_ci_server table. The values in my import file were "Windows Server" and "Linux Server" and these had to be changed upon import to "cmdb_ci_win_server" and "cmdb_ci_linux_server", respectively, as these are the actual values for the Class field in the table.
The short script to transform the values in the import file: