---
schema_version: "1"
id: 9a88c18a321cd66617f8f782f0de73358a38d050a5ccd8e4188a6eb9b2cee564
title: screenPop() 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-screenpop-lex.md
canonical_url: https://developer.salesforce.com/docs/service/api-cti/guide/sforce-api-cti-screenpop-lex.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 70ff1304f9dff619d2354f2da8632742381f89cff84ee17eb1b4e27b0119007f
products:
  - Open CTI Developer Guide
  - Service Cloud Developer Content
---

# screenPop() for Lightning Experience

## Usage

Pops to a new location as specified by the input type and parameters. This method is available in API version 38.0 or later.

**note:** Open CTI for Lightning Experience doesn't support the softphone layout field `Screen pops open within` when the value is `New browser window or tab`. In Lightning Experience, the default value is `Existing browser window`.

## Syntax

```javascript
sforce.opencti.screenPop({
    type: sforce.opencti.SCREENPOP_TYPE.*, //Review the arguments section.
    params: OBJECT //Depends on the SCREENPOP_TYPE. Review the arguments section.
});

```

## Arguments

|Name|Type|Description|
|------|------|-------------|
|`type`|string|Required. The screen pop target. Valid values: <ul><li>`SOBJECT`</li><li>`URL`</li><li>`OBJECTHOME`</li><li>`LIST`</li><li>`SEARCH`</li><li>`NEW_RECORD_MODAL`</li><li>`FLOW`</li></ul>|
|`params`|object|Required. Arguments for the specified `type` value. See [Type-Specific params Values](#type-specific-params-values).|
|`defaultFieldValues`|object|Optional. Pre-populates fields on a new-entity screen pop when no search results exist for an inbound call. Only applies when `type` is `NEW_RECORD_MODAL`. See the sample code below for an example.|
|`callback`|function|Optional. JavaScript method executed when the API call completes.|


## Type-Specific params Values

The `params` argument takes different fields depending on the value of `type`.

- `SOBJECT`

    - : 
      ```javascript
      params: { recordId: STRING }
      ```

      Where `recordId` is the ID of the standard or custom object in Salesforce.

 
- `URL`

    - : 
      ```javascript
      params: { url: STRING }
      ```

      The URL must be a relative path. For details on the `url` parameter, see `force:navigateToURL` in the *Lightning Aura Components Developer Guide*.

 
- `OBJECTHOME`

    - : 
      ```javascript
      params: { scope: STRING }
      ```

      Pops to the home page of an object such as a case or account. For details on the `scope` parameter, see `force:navigateToSObject` in the *Lightning Aura Components Developer Guide*.

      Example: `{ scope: "Account" }`

 
- `LIST`

    - : 
      ```javascript
      params: { listViewId: STRING, scope: STRING }
      ```

      For details on the `listViewId` and `scope` parameters, see `force:navigateToList` in the *Lightning Aura Components Developer Guide*.

 
- `SEARCH`

    - : 
      ```javascript
      params: { searchString: STRING }
      ```

      Pops to the Top Results section of the search page. The string must be at least 3 characters.

 
- `NEW_RECORD_MODAL`

    - : 
      ```javascript
      params: {
          entityName: STRING,      // required
          defaultFieldValues: object  // optional
      }
      ```

      `entityName` is the API name of the object, such as `Account`, `Case`, `Contact`, or `Lead`.

      For custom objects, use the format `{objectName}__c` (two underscores, default namespace).

      If your org has a namespace, use `namespace__{objectName}__c`.

      To pop to a new person account modal, use `Account`.

 
- `FLOW`

    - : 
      ```javascript
      params: {
          flowDevName: 'Flow_Dev_Name',
          flowArgs: [{ name: 'Name', type: 'Type', value: 'Value' }]
      }
      ```

      Pops to the target flow. Use `flowArgs` to pass additional arguments such as the caller's phone number or a list of matching records.

      Only active UI screen flows of type `Flow` can be popped. Arguments in `flowArgs` must be declared as variables inside the flow, or they are silently ignored at runtime. See the FlowVariable section in [the topic on Flow](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_visual_workflow.htm) in the Metadata API Developer Guide.

## Sample Code–HTML and JavaScript with a callback

<!-- html set_clipboard -->
```html
<html>
	<head>
   <script type="text/javascript" src="http://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 screenPop() {
                	sforce.opencti.screenPop({type: sforce.opencti.SCREENPOP_TYPE.OBJECTHOME, params: {scope:"Account"}, callback: callback  });
        	}
</script>
</head>
<body>
       <button onclick="screenPop();">screenPop</button>
</body>
</html>

```

## Response

This method is asynchronous. The response is returned in an object passed to a callback method. The response object contains the following fields.

|Name|Type|Description|
|------|------|-------------|
|`success`|boolean|Returns `true` if the API method call was invoked successfully, `false` otherwise.|
|`returnValue`|object|This API method doesn’t return this object. The `returnValue` is always `null`.|
|`errors`|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).|


