I have a Lightning Console App where our Case tab contains a standard case detail tab with two custom subtabs that gets opened upon creating a Case record.
We explicitly disabled 'X' on the Case tab along with the Subtabs so our customer base cannot close the Case tab unintentionally. Now, in case of some bad data, and if customer cannot close a case due to some permission issues, we gave an option (a new Aura Component) to close the entire tab along with the subtabs. It used to work, but all of a sudden we started to see the below error message:
Cannot update closeable due to workspace containing disabled subtabs.
Here is the logic we have to close the Case tab (if needed):
workspaceAPI.getAllTabInfo().then(function(response) {
response.forEach(element => {
if(element.subtabs != null && element.subtabs.length>0){
element.subtabs.forEach(ele => {
workspaceAPI.disableTabClose({
tabId: ele.tabId,
disabled: false
})
});
workspaceAPI.disableTabClose({
tabId: element.tabId,
disabled: false
}).then(function() {
workspaceAPI.closeTab({tabId: element.tabId});
}).catch(function(error) {
foundError = true;
console.log("Error is from here2: "+error);
});
}else {
if(!element.closeable){
workspaceAPI.disableTabClose({
tabId: element.tabId,
disabled: false
});
} else{
workspaceAPI.closeTab({tabId: element.tabId});
}
}
});
});
In the above logic, I have used 'disableTabClose' with 'disabled: false' so we get the two custom subtabs with 'x' so the flow should close the entire Case tab. But, all we are seeing is - 'x' is added to the two custom subtabs along with the actual parent case tab (at the top), still, the overall tab is not getting closed with the above error. Am I missing something?