[CMDB-Relationships] Best method to get all the relationships at different levels in scriptIssue The majority of the times we might get a situation where we needed to get all the relationships of a CI at different levels just as in relationship formatted on the CI form. In general, we use GlideQuery the cmdb_rel_ci table but this might lead to some performance issues. This article explains some OOB API that can be used to get all the relationships of a CI at different levels we wish. /api/now/cmdbrelation/relation/ReleaseAll releaseResolution""var request = new sn_ws.RESTMessageV2();request.setEndpoint('https://instance_name.service-now.com/api/now/cmdbrelation/relation/YourCISysID?sLevel=YourRequiredLevel');request.setHttpMethod('GET');// Eg. UserName="admin", Password="admin" for this code sample.// var user = 'YourUserName'; //(UserName)// var password = 'YourPassword'; //(Password)request.setBasicAuth(user,password);request.setRequestHeader("Accept","application/json");var response = request.execute();gs.log(response.getBody());""Sample Payload:\"childName\":\"VirtualMachine-LS8\",\"childrenCount\":1,\"childSysClassName\":\"cmdb_ci_server\",\"childSysId\":\"CiSysID\",\"relationTypeSysId\":\"RelationTypeID\",\"parents\":[{\"sysId\":\"CiSysID\",\"sysClassName\":\"cmdb_ci_server\",\"name\":\"VirtualMachine-LS7\"}],\"relationSysId\":\"RelationTypeID\",\"relationTable\":\"cmdb_rel_ci\",\"downStream\":false},{\"The returned payload contains the relationship, relationship level, relationship type, ChildClass class, ParentClass class, and their names, sys_ids.The above script will give the list of all relationships for the given CI and for up to a given level. You can utilize this API to simplify your script and make changes according to your requirements. Please let me know if you have any questions related to API.