# screenPop() for Salesforce Classic

## Usage

Pops to a target URL, which must be relative.

## Syntax

```javascript
sforce.interaction.screenPop(url:string, force:boolean, (optional) callback:function)
```

## Arguments

| Name       | Type     | Description                                                                                                                  |
| ---------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `url`      | string   | A relative URL, which specifies the location of the screen pop.                                                              |
| `force`    | boolean  | Set value to `true` to force a screen pop, `false` otherwise. This argument is only available in API version 28.0 and later. |
| `callback` | function | JavaScript method executed when the API method call is completed.                                                            |

## Sample Code–JavaScript

```javascript
<html>
<head>
   <script type="text/javascript" src="http://domain:port/support/api/28.0/interaction.js"></script>
   <script type="text/javascript">
       var callback = function (response) {
           if (response.result) {
              alert('Screen pop was set successfully.');
           }
           else {
              alert('Screen pop failed.' + result.error);
           }
        };
       function screenPop() {
                //Invokes API method
                sforce.interaction.screenPop('/001x0000003DGQR', true, callback);
        }
</script>
</head>
<body>
       <!-- Note that '001x0000003DGQR' is an example of an object Id to screen pop. -->
       <button onclick="screenPop();">screen pop to entity Id</button>
</body>
</html>
```

## Response

| Name     | Type    | Description                                                                                                                 |
| -------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
| `result` | boolean | `true` if the screen pop was successful, `false` if the screen pop wasn’t successful.                                       |
| `error`  | string  | If the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message. |
