+ Start a Discussion
Satya Prakash 11Satya Prakash 11 

Close a tab in Lightning Console in a visualforce page

Hello All-

I am trying to have console app work in both SFDC Classic and Lightning. I'm trying to close a sub tab via some JavaScript code. With Classic Console I did the following:

sforce.console.closeTab(id, callback);

The above method written in JS is invoked from apex:commandbutton with oncomplete attribute.

As per the documentation provided in Console Developer guide, closeTab() and getEnclosingTabId() methods are supported in both Classic and Lightning and no additional considerations are required to make the methods work in Lightning (https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_classic_bridge_methods.htm (https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_classic_bridge_methods.htm" style="color:#0563c1; text-decoration:underline)). But I see that the closeTab() functionality is not working as expected when accessed in Lightning experience.

I see there are some equivalent method which are supported only in Lightning Console here: https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_closeTab.htm (https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_closeTab.htm" style="color:#0563c1; text-decoration:underline)

But this is called from within a Lightning component. How can I do that from a VisualForce page?