Newer Version Available

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

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

Name Type Description
eventHandler function JavaScript method called when the agent's capacity for accepting chats has changed.

Sample Code–Visualforce

1<apex:page>
2    <apex:includeScript value="/support/console/50.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:

Name Type Description
count integer The number of chats in which the agent is currently engaged plus the number of chat requests currently assigned to the agent.
success Boolean true if firing event was successful; false if firing event wasn’t successful.