---
schema_version: "1"
id: 448a7e5ced8eee50ce851cea735fa204c2b23f8a17deeb5ca653677871322ca1
title: setSoftphoneWidth() for Salesforce Classic
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-setsoftphonewidth.md
canonical_url: https://developer.salesforce.com/docs/service/api-cti/guide/sforce-api-cti-setsoftphonewidth.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 55816dd68cf2ec4273e5723fba84a26b7cffcbac67aadfdea9a76db20ea67b09
products:
  - Open CTI Developer Guide
  - Service Cloud Developer Content
---

# setSoftphoneWidth() for Salesforce Classic

## Usage

Sets the softphone width in pixels for 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 because resizing multi-monitor component is not allowed.

## Syntax

```javascript
sforce.interaction.cti.setSoftphoneWidth(width:number, (optional) callback:function)
```

## Arguments

|Name|Type|Description|
|------|------|-------------|
|`width`|number|Softphone width in pixels. The width should be a number that’s equal or greater than 0.|
|`callback`|function|JavaScript method executed when the API method call is completed.|


## Sample Code–JavaScript

<!-- javascript set_clipboard -->
```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('Width was set successfully.');
           }
           else {
              alert('Width was not set successfully.');
           }
        };
</script>
</head>
<body>
       <button onclick="sforce.interaction.cti.setSoftphoneWidth(100, callback);">
       set softphone width to 100px
       </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|
|------|------|-------------|
|`result`|boolean|`true` if the width was set successfully, `false` if setting the width 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.|


