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
  • 1
    Provide a callback function and use setTimeout(function(){ alert("Hello"); }, 5000); Obviously replacing the alert with the code you need?
    – Eric
    Commented Aug 18, 2015 at 21:52

1 Answer 1

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?

You must log in to answer this question.

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