ScopedSessionDomain - 클라이언트

  • 릴리스 버전: Washingtondc
  • 업데이트 날짜 2024년 02월 01일
  • 읽기3분
  • ScopedSessionDomain API는 현재 세션 도메인과 관련된 기능을 제공하는 클라이언트 측 메서드를 포함하는 스크립트 포함입니다.

    이 API는 인스턴스에서 Domain Support - com.glide.domain.msp_extensions(Domain Extensions Installer 플러그인) 플러그인이 활성화된 경우에만 사용할 수 있습니다. 또한 호출자에게 이 API에 액세스하려면 관리자 역할이 있어야 합니다.

    ScopedSessionDomain - getCurrentDomainID()

    로그인한 사용자 세션에 대한 현재 도메인의 sys_id 반환합니다.

    반환되는 식별자는 도메인 유형 및 해당 도메인의 인스턴스화에 따라 달라집니다.
    • 사용자가 전역 도메인에 구성되어 있고 도메인 선택기를 사용하여 도메인을 전환하지 않는 경우 메서드는 null을 반환합니다.
    • 사용자가 도메인 선택기를 사용하여 전역 도메인으로 전환하는 경우 메서드는 문자열 "global"을 반환합니다.
    • 다른 모든 도메인의 경우 메서드는 해당 도메인의 sys_id 반환합니다.
    클라이언트 측 스크립트에서 이 메서드에 액세스하려면 GlideAjax() 를 사용하여 호출해야 합니다. 서버측 스크립트에서 이 메서드를 호출하려면 다음과 같은 방법을 사용하여 개체를 인스턴스화하고 메서드에 액세스합니다.
    var ssg = new global.ScopedSessionDomain(); 
    domainID = ssg.getCurrentDomainID();
    표 1. 매개변수
    이름 유형 설명
    없음
    표 2. 반환
    유형 설명
    문자열 현재 로그인한 사용자의 세션 도메인 Sys_id입니다. 도메인 선택기에 표시되는 것과 동일한 정보입니다.

    이 예제에서는 클라이언트측 스크립트에서 getCurrentDomainID() 메서드를 호출하는 방법을 보여 줍니다.

    // This example is calling the script include in a client script. 
    // This particular record is within the "Service Portal - Standard Ticket" scope. 
    // To reproduce this example: 
    //  1. Change application scope to "Service Portal - Standard Ticket" 
    //  2. Navigate to Client Script table and open a new form and name it anything 
    //  3. Set table=ticket_configuration (this table is within the same scope) 
    //  4. Set UI type=Desktop and Type=onLoad 
    //  5. Populate the script field with the script above 
    //  6. Navigate to the ticket_configuration table and open any form. 
    //
    // This will trigger the client script, invoke the API, and pop up a browser alert containing the sys_id of the user's current domain
    
    function onLoad() {	
      var ga = new GlideAjax("global.ScopedSessionDomain"); // Set the script include
      ga.addParam("sysparm_name", "getCurrentDomainID"); // Set the getCurrentDomainID method
      ga.getXML(getResponse);
    	
      function getResponse(response) {
         var answer = response.responseXML.documentElement.getAttribute('answer');
         alert(answer); // Pops up the sys_id of the domain record
      }
    }