1

I want to refresh the entire service console on clicking of the save button on the visual force page. The button is an inline visual force page. Any ideas?

<apex:includeScript value="/soap/ajax/26.0/connection.js"/>
<apex:includeScript value="/support/console/26.0/integration.js"/>
<script type="text/javascript">
function focusAndSave() {
    document.getElementById('focusMe').click();
}    
</script>


  <apex:form >
    <apex:pageBlock id="pb">
        <apex:pageMessages id="errMsgsId"></apex:pageMessages>
        <input type="text" id="focusMe" style="display:none" />
        <apex:pageBlockTable id="table" value="{!candidateMap}" var="c">
            <apex:column value="{!candidateMap[c].Contact__r.Name}"/>
            <apex:column value="{!candidateMap[c].Submitted_at__c}"/>
            <apex:column value="{!candidateMap[c].Interview_Availability__c}"/>
            <apex:column value="{!candidateMap[c].Notice_Available__c}"/>
            <apex:column headervalue="Stage">
                <apex:outputfield value="{!candidateMap[c].Stage__c}">
                    <apex:inlineEditSupport event="ondblclick"/>
                </apex:outputfield>
            </apex:column>
            <apex:column headervalue="Ideally looking for">
                <apex:outputfield value="{!candidateMap[c].Ideally_looking_for__c}">
                    <apex:inlineEditSupport event="ondblclick"/>
                </apex:outputfield>
            </apex:column>
            <apex:column headervalue="Action">
                <apex:commandLink value="Save" action="{!saveCandidate}" rerender="errMsgsId,table" onclick="focusAndSave()" oncomplete="testGetFocusedPrimaryTabId()">
                    <apex:param name="candidateId" value="{!candidateMap[c].Id}" assignTo="{!candidateId}"/>
                </apex:commandLink>
            </apex:column>
        </apex:pageBlockTable>
        <apex:panelGrid columns="7" style="margin: 0 auto;">
            <apex:outputLabel value="{!noOfRecords} records found"></apex:outputLabel>
            <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!first}" disabled="{!!hasPrevious}" title="First Page"/>
            <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!previous}" disabled="{!!hasPrevious}" title="Previous Page"/>
            <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!next}" disabled="{!!hasNext}" title="Next Page"/>
            <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!last}" disabled="{!!hasNext}" title="Last Page"/>
            <apex:outputLabel value="Page {!pageNumber} of {!pagecount}"></apex:outputLabel>
        </apex:panelGrid>
    </apex:pageBlock>
</apex:form>

enter image description here

2
  • you need to refresh only tab or console ?
    – Ratan Paul
    Nov 29, 2015 at 12:25
  • need to refresh the entire console.. so that all the opened pages shows the updated result Nov 29, 2015 at 12:29

2 Answers 2

0

Refresh primary tab

<apex:page standardController="Case">
    <apex:includeScript value="/support/console/26.0/integration.js"/>
    <A HREF="#" onClick="RefreshPrimaryTab();return false">
        Click here to get the primary tab IDs</A> 
    <script>
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>

</apex:page>

onclick of anchor tag call a RefreshPrimaryTab function

4
  • no still its not refreshing the whole console.. i gave it onComplete of the save hutton.. Nov 29, 2015 at 12:38
  • Please tell me how to refresh the primary tab.. I am new to service console Nov 29, 2015 at 12:40
  • @VetriselvanManoharan pls check my updated ans. I have tested my org. onComplete of the save button RefreshPrimaryTab function
    – Ratan Paul
    Nov 29, 2015 at 13:29
  • hey @VetriselvanManoharan let me know if this works for you or not?
    – Ratan Paul
    Nov 30, 2015 at 5:08
-1

We Can also use window.top.location='/console'; to refresh entire console.

You must log in to answer this question.

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