CI relationships multilevel downstream in a list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-17-2017 05:57 AM
Suppose we have a CI X
Its parents are P,Q and children are Y,Z
Now Y has children C and D and Z has children E and F.
I have to get all child CI's ( Y,Z,C,D,E, F) in a single list.
I am using the code (sample)
var childlist = [] ;
var prel = new GlideRecord ('cmdb_rel_ci');
prel.addQuery('parent',current.cmdb_ci);
prel.query();
while (prel.next())
{
gs.print ("list is" +prel.parent);
childlist.push(prel.child.toString());
}
But I get only 1 level downstream Ci (ie, CI Y and Z ,the children for current Ci X )from this.
How do I get the 2nd level downstream Cis and the subsequent levels for X ( ie C,D,E,F)
?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 07:29 AM
Without using code, you can use Explore Analytics to query downstream CIs.
In my example, this is what my stack for the business service Bond Trading looks like:
I created a list report with the filter "sys_id is downstream from Bond Trading":
In the list above, you can see even CIs that are multiple levels down (like PS Apache 01/02/03 or nyc oracle rac cluster) are shown.
You can also traverse the opposite way:
You can also group by an upstream or downstream dependency, and do a lot more refined filtering on the hierarchy.
For more information, you can watch our video on Business Service Reporting (it's not just limited to Business Services but that's a common use case).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2018 08:00 AM
Thanks for the reply but i need some code to work ongyedwab
We trying to get all the Child CIs and insert into the affected CIs related list.