0

I have my own released managed package which is installed on dev environment. I have created VF page on this environment and included Visualforce component from managed package there. The VF component has the following code which is responsible for refreshing Service Console tab:

 function refreshConsoleTab() {
     sforce.console.getEnclosingPrimaryTabId(refreshSubtab);
 }

 var refreshSubtab = functionrefreshSubtab(result) {
     var tabId = result.id;
     sforce.console.refreshPrimaryTabById(tabId, true, refreshSuccess);
 };
 var refreshSuccess = function refreshSuccess(result) {
     //Report whether refreshing the primary tab was successful
     if (result.success == true) {
         alert('Primary tab refreshed successfully');
     } else {
        alert('Primary did not refresh');
     }
};

The above code works in the managed package, and tab is being refreshed. However, it doesn't work in the dev environment where the managed package is installed.

I'm allowed to get tabId inside of refreshSubtab function, but sforce.console.refreshPrimaryTabById() returns success=false.

Note: I use 36 version of integration.js

<apex:includeScript value="/support/console/36.0/integration.js"/>

Thank you in advance for any help you can provide.

0

While I was looking for workaround I came across the one useful thing - Methods for Console Events, particularly addEventListener(). Using the following approach, I became able to refresh the Service console tab:

sforce.console.addEventListener(sforce.console.ConsoleEvent.CLOSE_TAB, openPrimaryTab);

function refreshTab() {
    sforce.console.getEnclosingTabId(function(result) {
        if (result.id) {
            sforce.console.closeTab(result.id);
        } else {
            alert('Could not find an enclosing primary TAB!');
        }
   });
}

function openPrimaryTab(result) {
    var tabUrl = "/" + result.objectId;
    sforce.console.openPrimaryTab(null, tabUrl, true, 'Loading...',
        function(result) {
            if (result.success == false) {
                alert('Primary tab cannot be opened');
            }
        }
    );
}

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.