---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# ConnectionInfo - Scoped, Global

# ConnectionInfo - Scoped, Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The ConnectionInfo API enables you to get connection attribute
information through the connection and credential alias.

You can use this API in scoped applications or within the global scope. In scoped scripts,
use the `sn_cc` namespace identifier.

For more information on connections and credentials, see [Credentials and connection
information](https://www.servicenow.com/docs/access?context=r-credentials&version=xanadu&pubname=xanadu-platform-security&ft:locale=en-US).

This function retrieves connection attribute information identified by the given connection
and credential alias.  

    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"]);
     }

## Scoped ConnectionInfo - getAttribute(String name) {#ariaid-title2}

Returns the value of a ConnectionInfo attribute with the specified
property name.
{#CI-getAttribute_S__table_ext_cx2_qbb__entry__3}

| Name | Type | Description |
|-|-|-|
| name | String | Name of a ConnectionInfo object property. |
[Table 1. Parameters]

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

| Type | Description |
|-|-|
| String | Value of a specified ConnectionInfo property. |
[Table 2. Returns]

{#CI-getAttribute_S__table_fxt_cx2_qbb}  

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

## Scoped ConnectionInfo - getCredentialAttribute() {#ariaid-title3}

Returns the value of credential attributes for a specified connection.
{#CI-getCredentialAttribute_S__table_ext_cx2_qbb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 3. Parameters]

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

| Type | Description |
|-|-|
| Object | Key-value pair map of credential attributes. |
[Table 4. Returns]

{#CI-getCredentialAttribute_S__table_fxt_cx2_qbb}  

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

## Scoped ConnectionInfo - getDataMap() {#ariaid-title4}

Returns the connection attributes as a collection of key-value pairs.
{#CI-getDataMap_S__table_ext_cx2_qbb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 5. Parameters]

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

| Type | Description |
|-|-|
| Object | Key-value pair map of connection attributes. |
[Table 6. Returns]

{#CI-getDataMap_S__table_fxt_cx2_qbb}  

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

## Scoped ConnectionInfo - getExtendedAttributes() {#ariaid-title5}

Returns the extended attributes as a collection of key-value pairs.
{#CI-getExtendedAttributes_S__table_ext_cx2_qbb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 7. Parameters]

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

| Type | Description |
|-|-|
| Object | Key-value pair map of extended attributes. |
[Table 8. Returns]

{#CI-getExtendedAttributes_S__table_fxt_cx2_qbb}  

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


