2

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. 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.

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

1 Answer 1

-1

var callCloseTab= function callCloseTab(result) {
    sforce.console.closeTab(result.id);
}

function closeTab() {
    sforce.console.getEnclosingTabId(callCloseTab);
}

closeTab();
</script>
1
  • 1
    Code dumps tend to be poor answers because they don't explain what the problem is, how to fix it, and why the fix works. This usually leads to a chain of comments like "that didn't work" and "try this instead" that make it harder for other people with similar questions to follow.
    – Derek F
    Dec 10, 2019 at 16:44

You must log in to answer this question.

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