function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
IKZIKZ 

Neither refreshTab() or force:refreshView work in console app

I've tried both options in custom lightning component and they work in sales app but as soon as I switch to console app refresh doesn't happen
1. 
refreshAndClose: function (component) {
        $A.get("e.force:refreshView").fire();
        let sObjectEvent = $A.get("e.force:navigateToSObject");
        sObjectEvent.setParams({
            "recordId": component.get("v.recordId")
        });
        sObjectEvent.fire();
    }

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

and as per https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_refreshTab.htm​​​​​​​ efreshTab() only works in Lightning console apps

any suggestions please?

​​​​​​​thanks
 
David Zhu 🔥David Zhu 🔥
You may check two places.

With option 1, do you have the refreshView handler defined in cmp file?
<aura:handler event="force:refreshView" action="{!c.doRefreshView}" />

With option 2, do you have Lightning:workspace component defined in cmp file?
<lightning:workspaceAPI aura:id="workspace" />
IKZIKZ
hi David, both were added, depending on the option
Strangely SF components are refreshed e.g. chatter, but not my custom one

I tried Akram G suggestion (https://salesforce.stackexchange.com/questions/179497/lightning-refreshview-event-not-working-on-record-detail-page)

User-added image

and it works, just not sure if that's the best solution, as I was trying to avoid refreshing all tabs like corresponding account for example