Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

onAgentStateChanged()

Registers a function to call when agents change their Chat status, such as from Online to Away. Available in API version 29.0 or later.

Syntax

Arguments

Name Type Description
eventHandler function JavaScript method called when the agent's Chat status has changed.

Sample Code–Visualforce

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
state String String that represents the agent’s current Chat status—for example, Online, Away, or Offline. When an agent switches from Offline to Away, you may see two returned values (Online then Away) instead of one (Away).
success Boolean true if firing event was successful; false if firing event wasn’t successful.