3

I'm trying to refresh case page in service console using javascript but its not working, can anyone tell me the issue with the following code? Also can anyone explain following usage condition mentioned in console API documents for tab refresh methods

"This method can't refresh subtabs with URLs to external pages or Visualforce pages"

<apex:page standardController="Case">
<A HREF="#" onClick="testCloseTab();return false">
    Click here to close this tab</A>
    {!now()}
<apex:includeScript value="/support/console/22.0/integration.js"/>
<script type="text/javascript">
    function testCloseTab() {
        //First find the ID of the current tab to refresh it
        sforce.console.getEnclosingTabId(refreshSubtab);
    }
    var refreshSubtab = function refreshSubtab(result){
        var subTabId = result.id;
        console.log(result);
        sforce.console.refreshSubtabById(subTabId, true, refreshSuccess );           
    }

    var refreshSuccess = function refreshSuccess(result) {
        console.log(result);
        //Report whether refreshing the subtab was successful
        if (result.success == true) {
            console.log('Subtab refreshed successfully');
        } else {
            console.log('Subtab did not refresh');
        }
    };
</script>

2

I was looking something similar and it has been a pain, finally I used:

window.top.location='/console';

in my script and now is refreshing my page. I hope it helps.

1
  • Thank you for this.. i've been struggling for past couple days to do this..and your comment is the only thing that worked. Thank you Vish
    – user20479
    May 14 '15 at 13:32
1

I also had a problem with refresh function. Maybe it works only with standard content?

My workaround is to do something like open with override. I used the following function to open the same page on already opened subtab.

sforce.console.openSubtab(
    primary_tab_id,
    page_to_reopen_url,
    true,
    'Label',
    sub_tab_to_reopen_id,
    openSubTabCallback

);

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.