Automatic relationship creation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2015 12:31 PM
I have created a relationship between parent class and child class in Suggested relation ship table. Based on this, when i import parent CI
and child CI to cmdb_ci tables , relation ships(in cmdb_rel_ci) will be created automatically? or do we need to create manually?
Thanks
Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2016 02:21 PM
We ended using an onAfter transform script to automatically create relationships from a file import in combination with the suggestions in the link I posted above on 12/15/2015. Hope this helps.
Thanks,
Sherry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2016 12:55 PM
Hi ,
I am trying to add relationship where I import the child. I i knew already the parent CI and relation type to be added.
Record is adding in the cmdb_rel_ci with empty paren CI and Child CI.
I added code in complee() transform script. Can you pl tell me what is the error in the following script
var grRel = new GlideRecord('cmdb_rel_ci');
grRel.parent.cmdb_ci.name ="X_ci";
grRel.child.cmdb_ci.name = "Y_ci";
grRel.type = "Connects to::Connected by";
inc.insertWithReferences();
Thanks
Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2016 02:44 PM
Try using the sys_id of the relationship type:
grRel.type = ("sys_id");
Also, you want to do the insert on the relationship table, so instead of inc.insertWithReferences(); use:
grRel.insertWithReferences();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2025 01:21 AM
You need to establish the relationships in cmdb_rel_ci explicitly
In ServiceNow, when you define relationships between parent and child classes in the Suggested Relationships table, the platform provides guidance on which relationships can exist. However, suggested relationships do not automatically create actual relationships in the cmdb_rel_ci table when you import Configuration Items (CIs) into the cmdb_ci table.