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.
chasitor.getCustomEvents()
Retrieves a list of custom events that have been received in this chat window during
this chat session. Available in API version 29.0 or
later.
Syntax
1liveagent.chasitor.getCustomEvents()Sample Code–Visualforce
1<a href="#" onClick="testGetCustomEvents();">Get Custom Events</a>
2
3<script type="text/javascript">
4 function testGetCustomEvents() {
5 events = liveagent.chasitor.getCustomEvents();
6 eventsCount = events.length;
7 alert('The following number of custom events have occurred: ' + eventsCount);
8 };
9</script>Response
This method is asynchronous so it returns its response in an object in a callback method. The response object contains the following methods and properties:
| Name | Type | Description |
|---|---|---|
| events | Array of event objects | An array of event
objects. Each object represents a custom event that has occurred in
this chat. Data on each message object can be accessed by the
following methods:
|
| getType | method | Accesses the type of the custom event that was sent to this chat window. Returns the type argument of the sforce.console.chat.sendCustomEvent() method used to send this event. |
| getData | method | Accesses the data of the custom event that was sent to this chat window. Returns the data argument of the sforce.console.chat.sendCustomEvent() method used to send this event. |
| getSource | method | Accesses the source of the custom event that was sent to this chat window—for example, agent or chat visitor. |
| getDate | method | Accesses the date of the custom event that was sent to this chat window. Returns the date and time the event was received. |