- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 03:00 AM
i have created CI relationship using script with Scheduled job and Script Include , relationships are visible in cmdb_rel_ci table but the relationships are not reflected in Dependency Map for CI?Please suggest me an option through which i can automatically create that using script
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2018 07:00 AM
Have you tried using newRecord() instead of initialize()... they are different as newRecord() sets default values.
I also noticed there's a field called connection_strength which is set to always when I manually created the record. Try setting that in your script and let me know.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 06:57 AM
Can you include a sample of the code and the results?
Tip: Ensure you are using relationship entries from cmdb_rel_type when you create the relationship.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2018 08:20 AM
Hi Chuck,
Yes i am inserting records in cmdb_rel_ci with type taken from cmdb_rel_type which resulted in CI relationship getting inserted but no effect in dependency view.
Could you also please let me know where those entries rae made when we manually create Dependency Map by clicking Add CI relationship Ui Action.
Please find the sample code.
var CIDR;
var gr = new GlideRecord('cmdb_ci_win_server');
gr.query();
while(gr.next())
{
CIDR = gr.u_inside_subnet_cidr; // referenc field returning sys_id
var grIn = new GlideRecord('cmdb_rel_ci');
grIn.initialize();
grIn.parent = CIDR;
grIn.child = gr.sys_id;
grIn.type = 'dc1f1f88db7193809020735a8c961966'; // sys_id of the Relationship Type
grIn.insert();
}
Thanks
Biswajyoti

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2018 07:00 AM
Have you tried using newRecord() instead of initialize()... they are different as newRecord() sets default values.
I also noticed there's a field called connection_strength which is set to always when I manually created the record. Try setting that in your script and let me know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2020 08:09 AM
Hello Biswa,
I am looking for the same solution, can you please let me know if you have the script to create relatioship.
Thanks,
kranthi.