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 06:53 AM
Now I go to cmdb_rel_ci table - Give Parent ABC and Child ABC (both ABC without selecting from dropdown) with Relationships Type Connects To::Connected By. It gives me an error as given before.
This is the part I need more detail on. Is this being done in a separate transform map when importing relationships? Is it being done in the same transform map as the CIs are being imported? Is it being done in a business rule, scheduled job, UI action, or something else after all CIs are imported?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2016 07:00 AM
Hi Chuck,
We do this in a separate transform map - mapping Parent.Name, Parent.Class, Relationship Type, Child.Name, Child.Class.
When I tried to do this from form UI - received the error so of course I will get the same error on load as well.
Please suggest the standard way to do this for bulk load of CI and CI Relationships data.
If possible using same sample data.
1) Class A with CI ABC
2) Class B with CI ABC
3) Any relationship between these 2 CIs
Regards,
Aditya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-13-2016 07:06 AM
Hi Aditya,
As stated before, your transform map will need to coalesce on something more than the name. If you can include the class, serial number, asset tag, or something else in your data import, you can get this done easily.
It's a bit like importing two employees with the same name and only using the name field to update records. You're going to have issues unless you add an employee ID, or something else unique.
Good luck.
Using the Coalesce Field - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2017 05:06 PM
Hi Chuck,
I have similar issue .. I have written Business Rule to insert record in 'cmdb_rel_ci' table...its inserting empty records. Please let me know if you get any solution for this.
var gr=new GlideRecord('x_42426_automation_automation_rules');
gr.addQuery('automation_category','calculate_relationship');
gr.orderBy('order');
gr.query();
gs.addInfoMessage('test 1');
while(gr.next())
{
var attribute=gr.getValue('target_attribute');
var val=gr.getValue('target_value');
var query = gr.getValue('query_string');
//gs.addInfoMessage('test 2');
var match=GlideFilter.checkRecord(current,query);
if (match)
{
var childT=current.name;
var manages='Managed by';
gs.addInfoMessage(val);
setRelationshipValues(val, childT, manages);
}
}
function setRelationshipValues(parent, child, relationshipType) {
gs.addInfoMessage(parent);
gs.addInfoMessage(child);
gs.addInfoMessage(relationshipType);
var rel_ci = new GlideRecord("cmdb_rel_ci");
rel_ci.initialize();
rel_ci.parent = parent;
rel_ci.child = child;
rel_ci.type = relationshipType;
if(rel_ci.parent!=rel_ci.child)
{
//rel_ci.gr=current.sys_id;
rel_ci.insert();
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-21-2017 04:41 AM
Hi Dhathri,
See the response on the other thread.