setSoftphonePanelWidth() for Lightning Experience

Usage

Sets the softphone panel width in the utility bar. The width must be specified in pixels. This method is available in API version 38.0 or later.

Syntax

sforce.opencti.setSoftphonePanelWidth({
   widthPX:WIDTH, 
   callback:FUNCTION  //Optional
});

Arguments

Name Type Description
widthPX number The softphone panel width in pixels. The height must be a number from 200 through 1,920.
callback function JavaScript method executed when the API method call is completed.

Sample Code–HTML and JavaScript

<!-- html set_clipboard -->
<html>
  <head>
    <script type="text/javascript" src="https://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 setSoftphonePanelWidth() {
          sforce.opencti.setSoftphonePanelWidth({widthPX: 400, callback: callback});
      }
     </script>
  </head>
  <body>
    <button onclick="setSoftphonePanelWidth();">setSoftphonePanelWidth()</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.