- 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
05-18-2020 01:31 AM
I know this is an old post but I came up with a solution for this with the following code:
answer = (function transformEntry(source) {
var tab = new GlideRecord('sys_choice');
tab.addEncodedQuery('elementSTARTSWITHsys_class_name^labelLIKE' + source.u_class);
tab.query();
if(tab.next()){
return tab.value; // return the value to be put into the target field
}
})(source);
This has worked using the table label value and successfully changes the target dependent on that value and allowed an import of over 20k CI's to numerous tables in one import.
Hope it helps someone else 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2020 09:37 AM
Thank you so much.