---
schema_version: "1"
id: 1166182bc589729640022bc7b60cf7c6daff129cbd9f03b43c358555c0848864
title: getAppViewInfo() for Lightning Experience
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/service-cloud/api-cti/guides/sforce-api-cti-getappviewinfo-lex.md
canonical_url: https://developer.salesforce.com/docs/service/api-cti/guide/sforce-api-cti-getappviewinfo-lex.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f5efa03c60b8a0b7a2bd5ebb4897e0197f8c36365e8062f1bda2619b928a3328
products:
  - Open CTI Developer Guide
  - Service Cloud Developer Content
---

# getAppViewInfo() for Lightning Experience

## Usage

Returns information about the current application view. This method is available in API version 38.0 or later.

## Syntax

```javascript
sforce.opencti.getAppViewInfo({
     callback: FUNCTION
});
```

## Arguments

|Name|Type|Description|
|------|------|-------------|
|`callback`|function|JavaScript method executed when the API method call is completed.|


## Sample Code–HTML and JavaScript

<!-- html set_clipboard -->
```html
<html>
  <head>
    <script type="text/javascript" src="https://domain:port/support/api//lightning/opencti_min.js"></script>
    <script type="text/javascript">
      var callback = function(response) {
         if (response.success) {
            console.log('API method call executed successfully! returnValue:', response.returnValue);
         } else { 
            console.error('Something went wrong! Errors:', response.errors);
         } 
      };

      function getAppViewInfo() {
          sforce.opencti.getAppViewInfo({callback: callback});
      }
     </script>
  </head>
  <body>
    <button onclick="getAppViewInfo();">getAppViewInfo()</button>
  </body>
</html>
```

## Response

This method is asynchronous. The response is returned in an object passed to a callback method.

When you switch from a record detail page to a list view, this method returns:


-   In Lightning Experience, only the `url`
-   In Lightning Experience console apps, nothing is returned because the listener isn’t invoked


- `success` (boolean)

    - : Returns `true` if the API method call was invoked successfully, `false` otherwise.

 
- `returnValue` (object)

    - : Returns the URL of the current application view and includes any applicable record ID, record name, and object type. For example:

      ```javascript
      {
          "url": "https://MYDOMAINNAMEmy.salesforce.com/lightning/r/Case/500D0000003tcchIAA/view?t=1459806689555",
          "recordId": "001x0000003DGQR",
          "recordName": "Acme",
          "objectType": "Account"
      }
      ```

      Invoking this API method on a person account object returns the following additional information.


      -   `accountId` or `contactId`—The associated account or contact ID.
      -   `personAccount`—Which is `true` if person accounts are enabled in your org, `false` otherwise.

      For example:

      ```javascript
      {
          "url": "https://MYDOMAINNAMEmy.salesforce.com/lightning/r/Account/001x0000003DGQR/view",
          "recordId": "001x0000003DGQR",
          "recordName": "Acme Person Account",
          "objectType": "Account",
          "contactId": "003D000000QOMqg",
          "personAccount": true
      }
      ```

      Since the URL structure of the `returnValue` can change in the future, we recommend that you don’t build any logic based on it.

 
- `error` (array)

    - : If the API call was successful, this variable is `null`. If the API call failed, this variable returns an array of [error messages](https://developer.salesforce.com/docs/service/api-cti/guide/sforce-api-cti-error-messages-lightning.md).

