Add custom CMDB related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 11:14 PM
Hey guys, I'm trying to add a new related list which shows the list of records from 'cmdb_rel_ci' table up-to a certain table only. This related list is
on the Change Request table. So when a CI(server/switch/router etc) gets selected, the new related list must display all the related CI's ground up.
Like this : Server 'related to' Database 'in turn related to' Application 'in turn related to' Bus Application service (this is a custom CI class). This issue here is the related list is not showing the
relationships 2 levels up, but only the first level. Any idea what can be done to show all the direct and in-direct relationships in the related list?
This is the screenshot:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 09:29 PM
Have you taken look at these scripts?
- CIUtils
- UpstreamImpactedCIUtil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 11:02 PM
Not yet, was thinking on creating this through Relationships...Is it possible?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2017 12:10 AM
It worked, at last!!! Thanks all of you for your timely inputs...
For any one else who has the same requirement, please use this script in 'relationships'. This would be between the Change Request and your Custom CI Class
var applications = [];
var gr = new GlideRecord('cmdb_rel_ci');
gr.addQuery('child',parent.cmdb_ci);
gr.query();
while(gr.next()){
if(gr.parent.sys_class_name == '<your_custom_CI_Class>') {
var basSID = gr.parent.sys_id;
current.addQuery('sys_id',basSID); //this is done to cater the first level relationship
} else {
applications.push(''+gr.parent.sys_id);
}
}
for(var i=0;i<applications.length;i++) {
var gr1 = new GlideRecord('cmdb_rel_ci');
gr1.addQuery('child',applications[i]);
gr1.addQuery('parent.sys_class_name','<your_custom_CI_Class>');
gr1.query();
var bas = [];
while(gr1.next()){
bas.push(''+gr1.parent.sys_id);
current.addQuery('sys_id',bas); //this is if the selected CI is 2 levels below your custom CI Class
}
}
Cheers