setSoftphonePanelIcon() for Lightning Experience

Usage

Sets the icon for the softphone panel. Returns true if the function is successfully executed, and false when there is a failure. This method is available in API version 38.0 or later.

The softphone panel icon.Screen shot of softphone in utility bar.

Syntax

sforce.opencti.setSoftphonePanelIcon({
     key:key, 
     callback:function  //Optional
});

Arguments

Name Type Description
key string The key corresponding to the icon in the Lightning Design System you want to use for the softphone panel icon.
callback function JavaScript method executed when the API method call is completed.

Sample Code–HTML and JavaScript

<html>
  <head>
    <script type="text/javascript" src="https://domain:port/support/api/63.0/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 setSoftphonePanelIcon() {
          sforce.opencti.setSoftphonePanelIcon({key:"call", callback: callback});
      }
     </script>
  </head>
  <body>
    <button onclick="setSoftphonePanelIcon();">setSoftphonePanelIcon()</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.