CIUtils - グローバル

  • リリースバージョン: Washingtondc
  • 更新日 2024年02月01日
  • 読む3読むのに数分
  • CIUtils スクリプトインクルードは、構成アイテム (CI) を操作するためのユーティリティクラスです。

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

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

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

    CIUtils - servicesAffectedByCI(文字列 CI_sys_id)

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

    表 : 1. パラメーター
    名前 タイプ 説明
    CI_sys_id 文字列 チェックする構成アイテム (cmdb_ci) の sys_id です。
    表 : 2. 返される内容
    タイプ 説明
    アレイ 指定されたアイテムの下流にある (または影響を受ける) cmdb_ci レコードの sys_id 値のアレイ

    この例は、名前が 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)

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

    表 : 3. パラメーター
    名前 タイプ 説明
    task GlideRecord タスク GlideRecord です (例:incident、change_request、problem)。
    表 : 4. 返される内容
    タイプ 説明
    アレイ タスクの cmdb_ci フィールドによって参照される構成アイテムの下流にある (または影響を受ける) CI の sys_id 値のアレイ

    この例は、 インシデント 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