---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# CIUtils - Global

# CIUtils - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The CIUtils script include is a utility class that provides methods for working with configuration items (CI).

By 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.

The maximum number of items returns is 1000. You can override this value by modifying the
glide.relationship.threshold property.

The CIUtils class is available to server-side scripts.

## CIUtils - servicesAffectedByCI(String CI_sys_id) {#ariaid-title2}

Determines which business services are affected by the specific configuration item
(CI).
{#r_CIUtils-servicesAffectedByCI_S__table_ity_vh1_4t__entry__3}

| Name | Type | Description |
|-|-|-|
| CI_sys_id | String | The sys_id of a configuration item (cmdb_ci) to check. |
[Table 1. Parameters]

{#r_CIUtils-servicesAffectedByCI_S__table_ity_vh1_4t} {#r_CIUtils-servicesAffectedByCI_S__table_jty_vh1_4t__entry__2}

| Type | Description |
|-|-|
| Array | An array of sys_id values for cmdb_ci records downstream of (or affected by) the specified item. |
[Table 2. Returns]

{#r_CIUtils-servicesAffectedByCI_S__table_jty_vh1_4t}  
This example displays the names of the services affected by the CI items with the name =
lnux100.

    var CIUtil = new CIUtils();
     
    //get a server record
    var server = new GlideRecord("cmdb_ci_server");
    server.addQuery("name", "lnux100");
    server.query();
    if (server.next()) {
      //get the affected services, array of ids
      var serviceIds = CIUtil.servicesAffectedByCI(server.getUniqueValue());
      for (var i=0; i < serviceIds.length; i++) {
        //get the service record
        var service = new GlideRecord("cmdb_ci_service");
        service.get(serviceIds[i]);
        gs.print(service.getDisplayValue());
      }
    }

Output:

    Client Services
    IT Services
    Bond Trading

## CIUtils - servicesAffectedByTask(GlideRecord task) {#ariaid-title3}

Determines which business services are affected by the specified task.
{#r_CIUtils-servicesAffByTask_GR__table_dml_r31_4t__entry__3}

| Name | Type | Description |
|-|-|-|
| task | GlideRecord | Task GlideRecord, for example incident, change_request, or problem. |
[Table 3. Parameters]

{#r_CIUtils-servicesAffByTask_GR__table_dml_r31_4t} {#r_CIUtils-servicesAffByTask_GR__table_eml_r31_4t__entry__2}

| Type | Description |
|-|-|
| Array | List of sys_id values for CIs downstream of (or affected by) the configuration item referenced by the task's cmdb_ci field. |
[Table 4. Returns]

{#r_CIUtils-servicesAffByTask_GR__table_eml_r31_4t}  
This example displays the names of the services affected by the incident INC00050.

    var CIUtil = new CIUtils();
     
    //get an incident record
    var inc = new GlideRecord("incident");
    inc.addQuery("number", "INC00050");
    inc.query();
    if (inc.next()) {
      //get the affected services, array of ids
      var serviceIds = CIUtil.servicesAffectedByTask(inc);
      for (var i=0; i < serviceIds.length; i++) {
        //get the service record
        var service = new GlideRecord("cmdb_ci_service");
        service.get(serviceIds[i]);
        gs.print(service.getDisplayValue());
      }
    }

Output:

    IT Services
    Email
    Windows Mobile
    Electronic Messaging
    Outlook Web Access (OWA)
    Blackberry


