8

We're using the Salesforce Console Integration Toolkit to display a custom status bar in the console. This works really well, except that the users can click on the status bar component (indicated by the hand cursor at the bottom of image below) to open up a popup window. Ideally, we don't want/need the user to open this (there's nothing to show, and in fact currently reads "This Space Intentionally Left Blank"). I've looked all over the documentation, but I can't seem to cause the status bar to not pop out a window at all, so our current implementation is to just call sforce.console.setCustomConsoleComponentVisible(false); using window.setInterval, but if we set the value too small, it lags the console, and if we set it too large, the window pops up and the user can see it until the next time it gets closed. Ideally, we'd like nothing to happen at all when the user clicks the status bar. Is there a way we prevent the custom console component from popping out its default popup window?

Console Popup for No Particular Reason

Here's the Visualforce page that implements the console component:

<apex:page showHeader="false" standardStylesheets="false">
    <apex:includeScript value="/support/console/34.0/integration.js" />
    <apex:includeScript value="{!URLFOR($Resource.ctiStatusJS)}" />
    <h1>
        This Space Intentionally Left Blank
    </h1>
</apex:page>

For the purposes of this component, here's the relevant JavaScript:

!function(window, document, undefined) {
    function heartbeat() {
        sforce.console.setCustomConsoleComponentVisible(false);
    }
    function init() {
        window.setInterval(heartbeat, 250);
    }
    window.addEventListener("DOMContentLoaded", init);
}(window, document)
5

You could use this onCustomConsoleComponentButtonClicked() to track the click event and setCustomConsoleComponentWindowVisible(false) to close the window.

Along with that, make window height and width to 1 pixel. (Though we cant make it 0).

<apex:page showHeader="false" standardStylesheets="false">
    <apex:includeScript value="/support/console/34.0/integration.js" />
    <script type="text/javascript">
            var eventHandler = function (result) {                 
            closeWindow(result);
        };

        var closeWindow = function closeWindow(result) {
            sforce.console.setCustomConsoleComponentVisible(false, result);
        };

        sforce.console.onCustomConsoleComponentButtonClicked(eventHandler);
    </script>
    <h1>
        This Space Intentionally Left Blank
    </h1>
</apex:page>

For more information, Refer onCustomConsoleComponentButtonClicked() and setCustomConsoleComponentVisible()

I have tried that, window is closing on clicking footer component.

  • I can't believe I missed this in the docs. Thanks! – sfdcfox Apr 18 '17 at 20:26
  • It happens, glad it helped you! – Santanu Boral Apr 18 '17 at 20:28
2

I would think you should be able to listen to that event using a click listener. The toolkit has an addEventListener method, so something like:

sforce.console.addEventListener('click', function (event) {
    // check if the proper component was clicked
});

You can also specify tabId in an optional third parameter (additionalParams), if you want to limit the scope of this listener.

I can't reproduce your layout to determine any further steps, but it ought to fire.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.