Can we have same CI names belonging to 2 different classes in CMDB? If yes, then how do we perform relationship data load into system?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2016 06:16 AM
Can we have same CI names belonging to 2 different classes in CMDB? If yes, then how do we perform relationship data load into system?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2016 07:49 AM
You can specify in the import file the CI class (sys_class_name) explicitly and then use a script to coalesce the correct CI.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2016 09:44 AM
Hi Aleksander,
I am still thinking, how to do it?
Ideally, cmdb_rel_ci table requires Parent/Child/Type to create a relationship correctly. Since I have same value in both Parent and Child though they belong to different classes the mapping with destination table is not straight forward. Not getting sys_class_name on destination - on UI it is appearing from Reference field. Still unable to understand why is this not working from UI.
Regards,
Aditya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2016 12:06 AM
Maybe you're selecting the same object or there are already relationships that together with the newly created one cause a recursive loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 01:28 PM
var gr=new GlideRecord('x_42426_automation_automation_rules');
gr.addQuery('automation_category','calculate_relationship');
gr.orderBy('order');
gr.query();
while(gr.next())
{
var attribute=gr.getValue('target_attribute');
var val=gr.target_value;
var query = gr.getValue('query_string');
var match=GlideFilter.checkRecord(current,query);
if (match)
{
var childT=current.sys_id;
var manages='bf83653c0ab30150761028c73a4de0f4';
setRelationshipValues(val, childT, manages);
}
}
function setRelationshipValues(parent, child, relationshipType) {
// gs.addInfoMessage(parent);
// gs.addInfoMessage(child);
// gs.addInfoMessage(relationshipType);
if (parent == child)
return;
var rel_ci = new GlideRecord("cmdb_rel_ci");
rel_ci.initialize();
rel_ci.parent.setDisplayValue(parent);
rel_ci.child = child;
rel_ci.type = relationshipType;
rel_ci.insert();
}