Newer Version Available
getEngagedChats()
Returns the chat keys of the chats in which the agent is currently engaged. Available in API version 29.0 or
later.
Syntax
1sforce.console.chat.getEngagedChats(callback:Function)Arguments
| Name | Type | Description |
|---|---|---|
| callback | function | JavaScript method called upon completion of the 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/29.0/integration.js"/>
19 <a href="#" onClick="testGetEngagedChats();return false;">Get Engaged Chats</a>
20
21 <script type="text/javascript">
22 function testGetEngagedChats() {
23 sforce.console.chat.getEngagedChats(function(result) {
24 if (result.success) {
25 alert('Number Engaged Chats: ' + result.chatKey.length);
26 } else {
27 alert('getEngagedChats has failed');
28 }
29 });
30 }
31 </script>
32</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 properties:
| Name | Type | Description |
|---|---|---|
| chatKey | array | Array of chatKey values, one for each of the currently engaged chats. |
| success | boolean | true if getting engaged chats was successful; false if getting engaged chats wasn’t successful. |