# setVisible() for Salesforce Classic

## Usage

Shows or hides the softphone in the Salesforce console.

:::note
If this method is used in a Salesforce console where multi-monitor components is turned on, an error will be returned.
:::

## Syntax

```javascript
sforce.interaction.setVisible(value:boolean, (optional) callback:function)
```

## Arguments

| Name       | Type     | Description                                                                              |
| ---------- | -------- | ---------------------------------------------------------------------------------------- |
| `value`    | boolean  | Set value to `true` to show the softphone or set value to `false` to hide the softphone. |
| `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/25.0/interaction.js"></script>
   <script type="text/javascript">
       var callback = function (response) {
           if (response.result) {
              alert(response.result);
           } else {
              alert(response.error);
           }
        };
   function setVisible(value) {
           sforce.interaction.setVisible(value, callback);
   }
</script>
</head>
<body>
       <button onclick="setVisible(false);">hide softphone</button>
</body>
</html>
```

## Response

| Name     | Type    | Description                                                                                                                 |
| -------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
| `result` | boolean | `true` if showing or hiding the softphone succeeded, `false` if showing or hiding the softphone didn’t succeed.             |
| `error`  | string  | If the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message. |
