fireEvent()
Syntax
sforce.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
<apex:page>
<apex:includeScript value="/support/console/63.0/integration.js"/>
<script type="text/javascript">
<A HREF="#" onClick="testFireEvent(); return false;">
Click here to fire an event of type 'SampleEvent'</A>
var callback = function(result) {
if (result.success) {
alert('The custom event is fired!');
} else {
alert('The custom event could not be fired!');
}
};
function testFireEvent() {
//Fire an event of type 'SampleEvent'
sforce.console.fireEvent('SampleEvent', 'EventMessage', callback);
}
</script>
</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. |