Newer Version Available

This content describes an older version of this product. View Latest

onSendCTIMessage()

Registers a function that is fired when a message is sent with the sendCTIMessage(). Use to get information or send information between an interaction log and a custom console component. This method is only available in API version 31.0 or later.

Syntax

1sforce.console.cti.onSendCTIMessage( eventHandler:Function )

Arguments

Name Type Description
eventHandler function JavaScript method called when a message is sent with the sendCTIMessage() method.

Sample Code–Visualforce

1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page>
18    <apex:includeScript value="/support/console/31.0/integration.js"/>
19     <script type="text/javascript">
20
21           var callback = function (result) {
22               alert('sendCTIMessage API sent the following message: ' + result.message);
23           };
24
25           sforce.console.cti.onSendCTIMessage(callback);
26
27           function sendCTIMessage() {
28               sforce.console.cti.sendCTIMessage('sending a message to CTI');
29           }
30     </script>
31     <a href="#" onClick="sendCTIMessage();return false">
32                 Send a message to see your listener receiving it!</a>
33</apex:page>

Response

This method is asynchronous, so it returns its response in an object in a callback method. The response object contains the following field:

Name Type Description
message string The message that was sent with the sendCTIMessage() method.