- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 03:39 AM
I am bulk uploading relationships to cmdb_rel_ci table using Transform Map, the source table has Child Name, Child Class, Type, Parent Name, Parent Class fields but the target has only Child, Parent and Type fields and there is no direct way to target class of child and parent.
The issue is happening when there are CIs with same but different class of cmdb, so suppose if I want CI name 'ABC' of class 'Application Service' as child but transform is itself picking up CI named 'ABC' of class 'Business Service'.
It seems targeting sys_id is not allowed to script/manually using even admin.
What should be done to solve it ? Any onBefore script can be suggested ?
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2022 03:47 AM
For each mapping use script instead of field to field mapping
For Parent field
var par = new GlideRecord (source.u_parent_class);
par.get('name', source.u_parent_name);
return par.sys_id;
For Child field
var child = new GlideRecord (source.u_child_class);
child.get('name', source.u_child_name);
return child.sys_id;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2022 03:23 PM
I asked this question and I have found one more answer which does not use script, still the one marked as correct answer to this question is liked by me more.
So what can be done is extract the sys_id of parent and child only and use that in the target field and target referenced field name, see following pics:
for accessing it first create a field map of source sys_id field to target parent field and same for child target field then click on the entry in field map list on transform map form.
Note: This option will only come if the target field is referenced field, I was searching once for it in a transform map targeting non-referenced fields. ;/ .