---
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


---

# ConnectionInfo - スコープ指定、グローバル

# ConnectionInfo - スコープ指定、グローバル {#ariaid-title1}

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

ConnectionInfo API を使用すると、接続および資格情報エイリアスを介して接続属性情報を取得できます。

この API は、スコープ対象のアプリケーションまたはグローバルスコープで使用できます。スコープ指定のスクリプトでは、`sn_cc` 名前空間識別子を使用します。

接続と資格情報の詳細については、「 [資格情報と接続情報](https://www.servicenow.com/docs/access?context=r-credentials&version=xanadu&pubname=xanadu-platform-security&ft:locale=en-US)」を参照してください。

この関数は、指定された接続および資格証明エイリアスによって識別される接続属性情報を取得します。  

    var provider = new sn_cc.ConnectionInfoProvider();

    // get a jdbc connection in the current domain with the alias ID
    //     "6219afbf9f03320021dd7501942e70fc"
    var connectionInfo = provider.getConnectionInfo("6219afbf9f03320021dd7501942e70fc");
    if (connectionInfo != null) {
      // get data map
      var datamap = connectionInfo.getDataMap();
      gs.info(datamap["name"]);
      gs.info(datamap["connection_url"]);

      // get the same values using getAttribute
      gs.info(connectionInfo.getAttribute("name"));
      gs.info(connectionInfo.getAttribute("connection_url"));

      // get credential attributes
      gs.info(connectionInfo.getCredentialAttribute("user_name"));
      gs.info(connectionInfo.getCredentialAttribute("password")); 

      // get extended attributes
      var extendedAttributes = connectionInfo.getExtendedAttributes();  
      gs.info(extendedAttributes["name1"]);
     }

     // get a jdbc connection in the ACME domain with the alias ID
     //      "cd5923ff9f03320021dd7501942e70bb"
     connectionInfo = provider.getConnectionInfoByDomain("cd5923ff9f03320021dd7501942e70bb",
            "c90d4b084a362312013398f051272c0d");
     if (connectionInfo != null) {
       // get data map
       var datamap = connectionInfo.getDataMap();
       gs.info(datamap["name"]);
     }

## ScopedConnectionInfo - getAttribute(String name) {#ariaid-title2}

指定されたプロパティ名を持つ ConnectionInfo 属性の値を返します。
{#CI-getAttribute_S__table_ext_cx2_qbb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| name | 文字列 | ConnectionInfo オブジェクトのプロパティの名前です。 |
[表 : 1. パラメーター]

{#CI-getAttribute_S__table_ext_cx2_qbb} {#CI-getAttribute_S__table_fxt_cx2_qbb__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | 指定された ConnectionInfo プロパティの値です。 |
[表 : 2. 返される内容]

{#CI-getAttribute_S__table_fxt_cx2_qbb}  

      // get the same values using getAttribute
      gs.info(connectionInfo.getAttribute("name"));
      gs.info(connectionInfo.getAttribute("connection_url"));

## スコープ付き ConnectionInfo - getCredentialAttribute() {#ariaid-title3}

指定された接続の信任状属性の値を返します。
{#CI-getCredentialAttribute_S__table_ext_cx2_qbb__entry__3}

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

{#CI-getCredentialAttribute_S__table_ext_cx2_qbb} {#CI-getCredentialAttribute_S__table_fxt_cx2_qbb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | 資格情報属性のキー/値ペアのマップです。 |
[表 : 4. 返される内容]

{#CI-getCredentialAttribute_S__table_fxt_cx2_qbb}  

     // get credential attributes
      gs.info(connectionInfo.getCredentialAttribute("user_name"));
      gs.info(connectionInfo.getCredentialAttribute("password")); 

## スコープ付き ConnectionInfo - getDataMap() {#ariaid-title4}

接続属性をキーと値のペアの集合として返します。
{#CI-getDataMap_S__table_ext_cx2_qbb__entry__3}

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

{#CI-getDataMap_S__table_ext_cx2_qbb} {#CI-getDataMap_S__table_fxt_cx2_qbb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | 接続属性のキー/値ペアのマップです。 |
[表 : 6. 返される内容]

{#CI-getDataMap_S__table_fxt_cx2_qbb}  

     // get data map
      var datamap = connectionInfo.getDataMap();
      gs.info(datamap["name"]);
      gs.info(datamap["connection_url"]);

## スコープ付き ConnectionInfo - getExtendedAttributes() {#ariaid-title5}

拡張属性をキーと値のペアの集合として返します。
{#CI-getExtendedAttributes_S__table_ext_cx2_qbb__entry__3}

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

{#CI-getExtendedAttributes_S__table_ext_cx2_qbb} {#CI-getExtendedAttributes_S__table_fxt_cx2_qbb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | 拡張属性のキー/値ペアのマップです。 |
[表 : 8. 返される内容]

{#CI-getExtendedAttributes_S__table_fxt_cx2_qbb}  

    // get extended attributes
      var extendedAttributes = connectionInfo.getExtendedAttributes();  
      gs.info(extendedAttributes["name1"]);
     }


