---
sourceDocument: Xanadu API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# CIUtils - グローバル

# CIUtils - グローバル {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：3分

CIUtils スクリプトインクルードは、構成アイテム (CI) を操作するためのメソッドを提供するユーティリティクラスです。

デフォルトでは、CI 関係を走査するときにシステムで使用される最大深度は 10 です。この値を上書きするには、glide.relationship.max_depth プロパティを変更します。

返されるアイテムの最大数は 1000 です。この値を上書きするには、glide.relationship.threshold プロパティを変更します。

CIUtils クラスはサーバー側のスクリプトで使用できます。

## CIUtils - servicesAffectedByCI(文字列 CI_sys_id) {#ariaid-title2}

特定の構成アイテム (CI) の影響を受けるビジネスサービスを判断します。
{#r_CIUtils-servicesAffectedByCI_S__table_ity_vh1_4t__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| CI_sys_id | 文字列 | チェックする構成アイテム (cmdb_ci) の sys_id です。 |
[表 : 1. パラメーター]

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

| タイプ | 説明 |
|-|-|
| アレイ | 指定されたアイテムの下流にある (または影響を受ける) cmdb_ci レコードの sys_id 値のアレイ |
[表 : 2. 返される内容]

{#r_CIUtils-servicesAffectedByCI_S__table_jty_vh1_4t}  
この例は、名前が lnux100 の CI アイテムの影響を受けるサービスの名前を表示します。

    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());
      }
    }

出力:

    Client Services
    IT Services
    Bond Trading

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

指定されたタスクの影響を受けるビジネスサービスを判断します。
{#r_CIUtils-servicesAffByTask_GR__table_dml_r31_4t__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| task | GlideRecord | タスク GlideRecord (インシデント、change_request、問題など)。 |
[表 : 3. パラメーター]

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

| タイプ | 説明 |
|-|-|
| アレイ | タスクの cmdb_ci フィールドによって参照される構成アイテムの下流の (または構成アイテムの影響を受ける) CI のsys_id値のリスト。 |
[表 : 4. 返される内容]

{#r_CIUtils-servicesAffByTask_GR__table_eml_r31_4t}  
この例は、 インシデント 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());
      }
    }

出力:

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


