Wednesday, 1 July 2015

How to Refresh a record in Console



Include JS in VF page
<apex:includeScript value="/support/console/26.0/integration.js"/>

Then use below link to open new record .
<A HREF="#" onClick="RefreshPrimaryTab();return false">         Click here to refresh </A>

Write below Java Script code in VF page
    <script type="text/javascript">
    
        function RefreshPrimaryTab() 
        {
            sforce.console.getFocusedPrimaryTabId(showTabId);
        }
            
        var showTabId = function showTabId(result) 
        {
            var tabId = result.id;
            alert('Primary Tab IDs: primaryTabId ' + tabId );
            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');
            }
        };
       
    </script>

Imp Link :- http://www.salesforce.com/us/developer/docs/api_console/Content/sforce_api_console_methods_tabs.htm