Newer Version Available
showWhenOffline
Use the showWhenOffline method to specify what customers see when a particular button is
offline.
Usage
Displays a particular element when the specified button is offline. Available in API versions 28.0 and later.
Syntax
void showWhenOffline(String buttonId, Object element, (optional) String userId)
Parameters
| Name | Type | Description | Available Versions |
|---|---|---|---|
| buttonId | String | The ID of the chat button for which to display the specified element object when no agents are available to chat. | Available in API versions 28.0 and later. |
| element | Object | The element to display when the specified button is offline. | Available in API versions 28.0 and later. |
| (Optional) userId | String | The ID of the agent to associate with the button. The element object is displayed when that agent is unavailable. | Available in API versions 29.0 and later. |
If you specify a button ID but not a user ID in your parameters, the element will be displayed only if the button is offline.
If you specify a user ID but not a button ID, the element will be displayed only if the agent is
offline. For example, the following syntax below tracks an agent’s online
status and sets the button to offline when that agent is
unavailable.
If
you specify a button ID and an agent ID, the element will display if neither the
button or the agent is available. For example, the syntax below tracks the status of
an agent and a button and displays the element if neither one is
available.
1liveagent.showWhenOffline('005xx000001Sv1m', document.getElementById('liveagent_button_toAgent_offline'));1liveagent.showWhenOffline('573xx0000000006', document.getElementById('liveagent_button_offline_573xx0000000006_USER1'), '005xx000001Sv1m');