I want to create function for reopening(refreshing) component or whole opened tab by clicking on the button.

I couldnt find any working example. I am using aura lightning component.


<lightning:button label="Storno" onclick="{!c.storno}" aura:id="new-trans-button"/>


storno : function (cmp, event, helper) {
        var subtabId = 'scc-st-0';
        sforce.console.refreshSubtabById(subtabId, true, refreshSuccess);

I used something like this, but i dont know how to get subtabId and i am getting error

sforce is not defined

You can access the console API via the lightning:workspaceAPI component. This has methods such as refreshTab that:

Refreshes a workspace tab or a subtab specified by tabId. Keep in mind that the first subtab has the same tabId as the workspace tab.

This component provides a "service" rather than rendering UI directly. Include it on your component and find it by its aura:id and invoke its methods.

Note that Promises are used in many methods to allow asynchronous completion.


you should use RefreshTab() method from lightning:Worksapce API.

PFB the sample Code:

<aura:component implements="flexipage:availableForAllPageTypes" access="global">
<lightning:workspaceAPI aura:id="workspace"/>
<lightning:button label="Refresh Focused Tab" onclick="{!c.refreshFocusedTab}"/>

Js Code

refreshFocusedTab : function(component, event, helper) {
    var workspaceAPI = component.find("workspace");
    workspaceAPI.getFocusedTabInfo().then(function(response) {
        var focusedTabId = response.tabId;
                  tabId: focusedTabId,
                  includeAllSubtabs: true
    .catch(function(error) {


for More info visit this link: https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_refreshTab.htm


In Salesforce classic Shift+C opens the recently closed tabs. In Lightning, you can go Your console->Customize Keyboard Shortcuts and set there.

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.