Newer Version Available
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
1swfobject.registerObject("clippy.codeblock-1", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17<apex:page>
18 <apex:includeScript value="/support/console/25.0/integration.js"/>
19 <script type="text/javascript">
20
21 <A HREF="#" onClick="testFireEvent(); return false;">
22 Click here to fire an event of type 'SampleEvent'</A>
23
24 var callback = function(result) {
25 if (result.success) {
26 alert('The custom event is fired!');
27 } else {
28 alert('The custom event could not be fired!');
29 }
30 };
31
32 function testFireEvent() {
33 //Fire an event of type 'SampleEvent'
34 sforce.console.fireEvent('SampleEvent', 'EventMessage', callback);
35 }
36 </script>
37</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. |