+ Start a Discussion
Oldwen AdrianoOldwen Adriano 

VF page inside account console action

Hello everyone,

I have a Visualforce page included in my account page layout.  Inside that VF page I am running some javascript to update and check conditions of the account.  I am stuck on one particular task.  If a certain condition is true, then I want to close the account tab console that was opened and redirect the user to a VF page that displays whatever info.  When I attempt to run the javascript examples I found, nothing happens. 

I simply took the code from a SF example, but I am unable to make it work...
 
if(Unavailable == true)
    {
        testCloseTab();

    }

function testCloseTab() {
        //First find the ID of the current tab to close it
        sforce.console.getEnclosingTabId(closeSubtab);
    }
    
    var closeSubtab = function closeSubtab(result) {
        //Now that we have the tab ID, we can close it
        var tabId = result.id;
        sforce.console.closeTab(tabId);
    };


I also need some help with the redirect. 

Thank you in advance....
 
James LoghryJames Loghry
If you haven't gotten this working yet, I would suggest adding debugger; statements inside your if statement and the function to see if that logic is exectuing.  You can test this out by opening the developer console in chrome for instance.  If / when the debugger breakpoint is hit, you can then use the console to execute javascript and investigate the variables and hopefully figure out your issue.