setSoftphoneWidth() for Salesforce Classic

Usage 

Sets the softphone width in pixels for the Salesforce console.

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.

Note

Syntax 

1sforce.interaction.cti.setSoftphoneWidth(width:number, (optional) callback:function)

Arguments 

NameTypeDescription
widthnumberSoftphone width in pixels. The width should be a number that’s equal or greater than 0.
callbackfunctionJavaScript method executed when the API method call is completed.

Sample Code–JavaScript 

1<html>
2<head>
3   <script type="text/javascript" src="http://domain:port/support/api/25.0/interaction.js"></script>
4   <script type="text/javascript">
5       var callback = function (response) {
6           if (response.result) {
7              alert('Width was set successfully.');
8           }
9           else {
10              alert('Width was not set successfully.');
11           }
12        };
13</script>
14</head>
15<body>
16       <button onclick="sforce.interaction.cti.setSoftphoneWidth(100, callback);">
17       set softphone width to 100px
18       </button>
19</body>
20</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.

NameTypeDescription
resultbooleantrue if the width was set successfully, false if setting the width wasn’t successful.
errorstringIf the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message.