onCurrentCapacityChanged()

Registers a function to call when an agent’s capacity for accepting chats changes—for example, if an agent accepts a new chat, ends a currently engaged chat, or otherwise changes the number of chats to which they are assigned, or if a chat request is pushed to their chat queue. Available in API version 29.0 or later.

Syntax 

1sforce.console.chat.onCurrentCapacityChanged(eventHandler:Function)

Arguments 

NameTypeDescription
eventHandlerfunctionJavaScript method called when the agent’s capacity for accepting chats has changed.

Sample Code–Visualforce 

1<apex:page>
2    <apex:includeScript value="/support/console/68.0/integration.js"/>
3    <script type="text/javascript">
4        var eventHandler = function (result) {
5            alert('Capacity Changed. Current Requests + Engaged Chats is now: ' + result.count);
6        }
7        sforce.console.chat.onCurrentCapacityChanged(eventHandler);
8    </script>
9</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:

NameTypeDescription
countintegerThe number of chats in which the agent is currently engaged plus the number of chat requests currently assigned to the agent.
successBooleantrue if firing event was successful; false if firing event wasn’t successful.