I'm working in the Salesforce Service Console with the console integration toolkit. This allows us to fire (HTML5) events with the sforce.console.fireEvent() command. I firing an event from one console component (a visualforce page) that will be caught by an event listener on another console component (another visualforce page). Normally this kind of event passing works, but when I try to fire an event and then refresh the page that I'm by setting location = ... my event does not fire successfully.

What am I doing wrong?

1 Answer 1


The events that are fired in the console are asynchronous events, similar to callouts to other web services. When you do something that refreshes the page (such as setting location=...) this triggers a Javascript unload() event. By design, when a browser is unloading a page it does a whole bunch of stuff, including dropping any asynchronous events it had initiated. This means that your fireEvent() call is just dropped and does nothing.

I've tried a number of workarounds to this, but the most reliable is to fire the event using it's optional callback function and then reload the page that you're firing the event from only after the event has been sent. For example:

var reloadPageAfterEventReturns = function(callResult) {
  if (callResult.success) {
    location = "/apex/newLocation";
sforce.console.fireEvent("myEvent", "Event message", reloadPageAfterEventReturns);

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .