If nothing works here and you cannot use donot / cant use beta feature of lightning tab refresh.
Then try this. This is an internal api event of refresh tab event which basically triggers a tag refresh as you would do in Primary and Secondary tabs.
refreshTab() {
this.invokeWorkspaceAPI('isConsoleNavigation').then(isConsole => {
if (isConsole) {
this.invokeWorkspaceAPI('getFocusedTabInfo').then(focusedTab => {
this.invokeWorkspaceAPI('refreshTab', {
tabId: focusedTab.tabId
}).then(response => {
this.dispatchEvent(new CloseActionScreenEvent());
})
});
}
});
}
invokeWorkspaceAPI(methodName, methodArgs) {
return new Promise((resolve, reject) => {
const apiEvent = new CustomEvent("internalapievent", {
bubbles: true,
composed: true,
cancelable: false,
detail: {
category: "workspaceAPI",
methodName: methodName,
methodArgs: methodArgs,
callback: (err, response) => {
if (err) {
return reject(err);
} else {
return resolve(response);
}
}
}
});
this.dispatchEvent(apiEvent);
window.dispatchEvent(apiEvent);
});
}
UPDATE
I tested this and this perfectly well with quick action + console application.
html : Just to test workspace api
<!-- Update Related Lost -->
<template>
<lightning-button class="slds-m-around_large" onclick={refreshTab} title="Refresh Tab" label="Refresh Tab"></lightning-button>
</template>
JS :
/**
* Created by nagendrakumar.singh on 30/10/23.
*/
import {LightningElement} from 'lwc';
import {CloseActionScreenEvent} from "lightning/actions";
export default class UpdateRelatedLost extends LightningElement {
refreshTab() {
this.invokeWorkspaceAPI('isConsoleNavigation').then(isConsole => {
console.log('isConsole -> '+isConsole);
if (isConsole) {
this.invokeWorkspaceAPI('getFocusedTabInfo').then(focusedTab => {
console.log('focusedTab -> '+focusedTab.tabId);
this.invokeWorkspaceAPI('refreshTab', {
tabId: focusedTab.tabId
}).then(response => {
this.dispatchEvent(new CloseActionScreenEvent());
})
});
}
});
}
invokeWorkspaceAPI(methodName, methodArgs) {
return new Promise((resolve, reject) => {
const apiEvent = new CustomEvent("internalapievent", {
bubbles: true,
composed: true,
cancelable: false,
detail: {
category: "workspaceAPI",
methodName: methodName,
methodArgs: methodArgs,
callback: (err, response) => {
if (err) {
return reject(err);
} else {
return resolve(response);
}
}
}
});
this.dispatchEvent(apiEvent);
window.dispatchEvent(apiEvent);
});
}
}
meta xml :
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>59.0</apiVersion>
<description>Update Related Lost</description>
<isExposed>true</isExposed>
<masterLabel>Update Related Lost</masterLabel>
<targets>
<target>lightning__RecordAction</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__RecordAction">
<actionType>ScreenAction</actionType>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>
I see all console logs properly printing
And also related list being refreshed and fetching data.
eval("$A.get('e.force:refreshView').fire();");
, which is likely to work?!eval
will work inside of your regular Javascript.updateRecord
function fromuiRecordApi
and only passed the Id field to it.