0

I have a visualforce page section in service cloud console, section has VF buttons which opens the PrimaryTab.

I want to auto close the newly opened PrimaryTab after 5 sec, is it possible add timer in console page?

here is my page will look like.

<apex:page standardController="contact"  standardStylesheets="false" >
<script type="text/javascript">
function Refresh() {
 sforce.console.openPrimaryTab(null, '/apex/RefreshPage?scontrolCaching=1&id={!contact.ID}', true,'Refresh', closeTab, 'Refresh');
}
function closeTab(result) {
    if (result.success == true) {
       var tabId = result.id;
       sforce.console.closeTab(tabId);
    } 
    else {
    //alert('XXXX');
    }

};
</script>

<apex:form id="myform" > 
    <apex:pageblock >  
        <apex:pageBlockButtons location="Top"> 
            <apex:commandButton value="Refresh" onclick="Refresh();return false" styleClass="buttonStyle" style="background:LightBlue;width:60px;float:Center;" /> 
        </apex:pageBlockButtons> 
     </apex:pageblock> 
    </apex:form>

  • 1
    Provide a callback function and use setTimeout(function(){ alert("Hello"); }, 5000); Obviously replacing the alert with the code you need? – Eric Aug 18 '15 at 21:52
1

Posting comment as answer

Provide a callback function and use setTimeout(function(){ alert("Hello"); }, 5000); Obviously replacing the alert with the code you need?

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.