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 11:00 PM
Yep, didn't work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 12:42 AM
Remove GlideRecord Statements as they just impacting the performance and doing noting with the logic. As of nor addQuery is only including 1st level of relationships. You may need to add 2nd level as well.
current.addQuery('parent.sys_id',parent.cmdb_ci); //1st Level
var orCond = current.addOrCondition('child.sys_id',parent.cmdb_ci); //1st Level
orCond.addOrCondition('parent.parent.sys_id',parent.cmdb_ci); //2nd Level
orCond.addOrCondition('child.child.sys_id',parent.cmdb_ci); //2nd Level
orCond.addOrCondition('parent.child.sys_id',parent.cmdb_ci); //2nd Level
orCond.addOrCondition('child.parent.sys_id',parent.cmdb_ci); //2nd Level
further you may need to apply filters to restrict records on basis of class otherwise it will results in a very large list and will impact loading times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 04:03 PM
Nah mate, it ain't working. Just seeing 1 record in the related list which is the only relationship of that selected CI. I need to replicate the exact functionality of existing OOTB related list 'Business Service' which shows the related Business Service of a CI which has any relationship be it any levels down.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 07:45 PM
A small change in the code and its working
var orCond = current.addQuery('parent.sys_id',parent.cmdb_ci); //1st Level
orCond.addOrCondition('child.sys_id',parent.cmdb_ci); //1st Level
orCond.addOrCondition('parent.parent.sys_id',parent.cmdb_ci); //2nd Level
orCond.addOrCondition('child.child.sys_id',parent.cmdb_ci); //2nd Level
orCond.addOrCondition('parent.child.sys_id',parent.cmdb_ci); //2nd Level
orCond.addOrCondition('child.parent.sys_id',parent.cmdb_ci); //2nd Level
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2017 09:09 PM
Okay, this is the requirement:
If either a server or a database or a Application CI is selected, only the top BAS CI (u_cmdb_ci_business_application_service) needs to be in the related list. An exact replica of the functionality is currently in the OOTB 'Business Services (Impacted Services)' related list (but this is for 'cmdb_ci_services' table)
The above script doesn't show the BAS record...it shows all the relationships records. If there are no in-direct relationships with BAS class, then the related list should come up empty
Hope this clarifies the question.