{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":965,"path":"api-reference/server-api-reference/c_CIUtilsAPI.md","title":"CIUtils - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# CIUtils- Global\n\nThe CIUtils script include is a utility class that provides methods for working with configuration items \\(CI\\).\n\nBy default, when traversing CI relationships the system uses a max depth of 10. You can override this value by modifying the glide.relationship.max\\_depth property.\n\nThe maximum number of items returns is 1000. You can override this value by modifying the glide.relationship.threshold property.\n\nThe CIUtils class is available to server-side scripts.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## CIUtils - servicesAffectedByCI\\(String CI\\_sys\\_id\\)\n\nDetermines which business services are affected by the specific configuration item \\(CI\\).\n\n|Name|Type|Description|\n|----|----|-----------|\n|CI\\_sys\\_id|String|The sys\\_id of a configuration item \\(cmdb\\_ci\\) to check.|\n\n|Type|Description|\n|----|-----------|\n|Array|An array of sys\\_id values for cmdb\\_ci records downstream of \\(or affected by\\) the specified item.|\n\nThis example displays the names of the services affected by the CI items with the name = lnux100.\n\n```\nvar CIUtil = new CIUtils();\n \n//get a server record\nvar server = new GlideRecord(\"cmdb_ci_server\");\nserver.addQuery(\"name\", \"lnux100\");\nserver.query();\nif (server.next()) {\n  //get the affected services, array of ids\n  var serviceIds = CIUtil.servicesAffectedByCI(server.getUniqueValue());\n  for (var i=0; i < serviceIds.length; i++) {\n    //get the service record\n    var service = new GlideRecord(\"cmdb_ci_service\");\n    service.get(serviceIds[i]);\n    gs.print(service.getDisplayValue());\n  }\n}\n```\n\nOutput:\n\n```\nClient Services\nIT Services\nBond Trading\n```\n\n## CIUtils - servicesAffectedByTask\\(GlideRecord task\\)\n\nDetermines which business services are affected by the specified task.\n\n|Name|Type|Description|\n|----|----|-----------|\n|task|GlideRecord|Task GlideRecord, for example incident, change\\_request, or problem.|\n\n|Type|Description|\n|----|-----------|\n|Array|List of sys\\_id values for CIs downstream of \\(or affected by\\) the configuration item referenced by the task's cmdb\\_ci field.|\n\nThis example displays the names of the services affected by the incident INC00050.\n\n```\nvar CIUtil = new CIUtils();\n \n//get an incident record\nvar inc = new GlideRecord(\"incident\");\ninc.addQuery(\"number\", \"INC00050\");\ninc.query();\nif (inc.next()) {\n  //get the affected services, array of ids\n  var serviceIds = CIUtil.servicesAffectedByTask(inc);\n  for (var i=0; i < serviceIds.length; i++) {\n    //get the service record\n    var service = new GlideRecord(\"cmdb_ci_service\");\n    service.get(serviceIds[i]);\n    gs.print(service.getDisplayValue());\n  }\n}\n```\n\nOutput:\n\n```\nIT Services\nEmail\nWindows Mobile\nElectronic Messaging\nOutlook Web Access (OWA)\nBlackberry\n```\n\n"}}