---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# ScopedSessionDomain :クライアント

# ScopedSessionDomain :クライアント {#ariaid-title1}

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

現在のセッションドメインに関連する機能を提供するクライアントサイドメソッドを含む ScopedSessionDomain スクリプトインクルード。

この API は、インスタンスで Domain Support - Domain Extensions Installer プラグイン (com.glide.domain.msp_extensions) プラグインがアクティブ化されている場合にのみ使用できます。さらに、この API にアクセスするには、発信者は admin ロールを持っている必要があります。

## ScopedSessionDomain:getCurrentDomainID() {#ariaid-title2}

ログインしたユーザーセッションの現在のドメインのsys_idを返します。
返される識別子は、ドメインタイプとそのドメインのインスタンス化によって異なります。

* ユーザーがグローバルドメインで構成されており、ドメインピッカーを使用してドメインを切り替えない場合、このメソッドは null を返します。
* ユーザーがドメインピッカーを使用してグローバルドメインに切り替えた場合、このメソッドは文字列「global」を返します。
* 他のすべてのドメインでは、このメソッドはそのドメインのsys_idを返します。  
クライアントサイドスクリプトからこのメソッドにアクセスするには、 [GlideAjax()](https://servicenow-prod.fluidtopics.net/_H_u5hWyVPIsn1UCNOf2yA#c_GlideAjaxAPI "GlideAjax クラスを使用すると、クライアントスクリプトがスクリプトインクルード内のサーバーサイドコードを呼び出すことができます。") を使用してメソッドを呼び出す必要があります。サーバーサイドスクリプトからこのメソッドを呼び出すには、次のようなものを使用してオブジェクトをインスタンス化し、メソッドにアクセスします。

    var ssg = new global.ScopedSessionDomain(); 
    domainID = ssg.getCurrentDomainID();

{#SSD-getCurrentDomainID__table_xrg_dfr_xnb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 1. パラメーター]

{#SSD-getCurrentDomainID__table_xrg_dfr_xnb} {#SSD-getCurrentDomainID__table_yrg_dfr_xnb__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | 現在ログインしているユーザーのセッションドメインのSys_id。これは、ドメインピッカーに表示される情報と同じです。 |
[表 : 2. 返される内容]

{#SSD-getCurrentDomainID__table_yrg_dfr_xnb}  
この例では、クライアント側スクリプトから 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
      }
    }


