CIUtils - 전역

  • 릴리스 버전: Yokohama
  • 업데이트 날짜 2025년 01월 30일
  • 읽기3분
  • CIUtils 스크립트 포함은 CI(구성 항목)를 사용하기 위한 메서드를 제공하는 유틸리티 클래스입니다.

    기본적으로 CI 관계를 통과할 때 시스템은 최대 깊이 10을 사용합니다. glide.relationship.max_depth 속성을 수정하여 이 값을 재정의할 수 있습니다.

    반환되는 최대 항목 수는 1000입니다. glide.relationship.threshold 속성을 수정하여 이 값을 재정의할 수 있습니다.

    CIUtils 클래스는 서버 쪽 스크립트에서 사용할 수 있습니다.

    CIUtils - servicesAffectedByCI(String 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 작업)

    지정된 작업의 영향을 받는 비즈니스 서비스를 결정합니다.

    표 3. 매개변수
    이름 유형 설명
    작업 GlideRecord 작업 GlideRecord(예: 인시던트, change_request 또는 문제)
    표 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