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.
fireEvent()
Syntax
1sforce.console.fireEvent( eventType:String, message:String, (optional)callback:Function )Arguments
| Name | Type | Description |
|---|---|---|
| eventType | string | The type of custom event to fire. |
| message | string | The message which is sent with the fired event. |
| callback | function | JavaScript method called when the custom event is fired. |
Sample Code–Visualforce
1<apex:page>
2 <apex:includeScript value="/support/console/68.0/integration.js"/>
3 <script type="text/javascript">
4
5 <A HREF="#" onClick="testFireEvent(); return false;">
6 Click here to fire an event of type 'SampleEvent'</A>
7
8 var callback = function(result) {
9 if (result.success) {
10 alert('The custom event is fired!');
11 } else {
12 alert('The custom event could not be fired!');
13 }
14 };
15
16 function testFireEvent() {
17 //Fire an event of type 'SampleEvent'
18 sforce.console.fireEvent('SampleEvent', 'EventMessage', callback);
19 }
20 </script>
21</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 field:
| Name | Type | Description |
|---|---|---|
| success | boolean | true if firing the event is successful, false if firing the event wasn’t successful. |