fireEvent()

Fires a custom event. This method is only available in API version 25.0 or later.

Syntax 

1sforce.console.fireEvent( eventType:String, message:String, (optional)callback:Function )

Arguments 

NameTypeDescription
eventTypestringThe type of custom event to fire.
messagestringThe message which is sent with the fired event.
callbackfunctionJavaScript 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:

NameTypeDescription
successbooleantrue if firing the event is successful, false if firing the event wasn’t successful.