enableClickToDial() for Salesforce Classic

Usage

Enables click-to-dial.

Syntax

sforce.interaction.cti.enableClickToDial( (optional) callback:function )

Arguments

Name Type Description
callback function JavaScript method executed when the API method call is completed.

Sample Code–JavaScript

<!-- javascript set_clipboard -->
<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('Click to dial was enabled.');
           } else { 
              alert('Click to dial was not enabled.');
           } 
        };
        function enableClickToDial() {
   //Invokes API method
   sforce.interaction.cti.enableClickToDial(callback);
   }
</script>
</head>
<body>
   <button onclick="enableClickToDial();">enable click to dial</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 click-to-dial was enabled, false if click-to-dial wasn’t enabled.
error string If the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message.