List of CI.s Upstream and downstream
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi Mates,
one of my clients needs for reporting purpose List of CI.s Upstream and downstream data ..
Is there any possibility to get those data .
or need to write any scripting .
Need your help !
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @pramn
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hi @pramn ,
In ServiceNow, all CI relationships are stored in the CI Relationship table (cmdb_rel_ci).
Whenever a relationship is created between two CIs, the platform automatically inserts a record into this table with:
- a Parent CI
- a Child CI
- and the Relationship Type (e.g., Depends on, Contains, etc.)
✅ Creating a Report
If your requirement is to report on upstream/downstream CIs, you can build a report directly on the cmdb_rel_ci table.
To get all CIs related to a specific parent CI, set:
- Table: cmdb_rel_ci
- Group By: Parent
- Apply filters as needed.
This will give you a list of all child CIs related to each parent CI.
✅ Retrieving Child CIs via Script
If you want to programmatically list the child CIs and print their names in the logs, you can use the following script:
var gr = new GlideRecord('cmdb_rel_ci');
gr.addQuery('parent','14bca7efdb0c10104779141b13961998');//the sys_id of parent CI .
var count = 0;
gr.query();
while(gr.next()){
count++;
gs.print ('The Child name ' +gr.child.name+' is '+count+' th child');
}
This script loops through all relationship records where the specified CI is the parent, counts them, and prints each child CI’s name and order.
If this solution helps, please mark it as Helpful and Accept the Solution to close the thread.
Regards,
Sagnic
