1

I am using workspaceAPI to open a subtab from a parent tab. I am using setTabLabel to set the subtab label, but I have noticed the browser tab displayed as "Loading". Any suggestion?

 workspaceAPI
            .isConsoleNavigation()
            .then(function(isConsole) {
                if (isConsole) {
                    navService.generateUrl(pageReference).then(function(cmpURL) {
                        workspaceAPI
                        .getEnclosingTabId()
                        .then(function(tabId) {
                             return workspaceAPI.openSubtab({                            
                                parentTabId: tabId,
                                url: cmpURL,
                                focus: true
                            });                        
                        })
                        .then(function(subTabId) {                            
                            workspaceAPI.setTabLabel({
                                tabId: subTabId,
                                label: "Debt Accounts"
                            });

                            workspaceAPI.setTabIcon({
                                tabId: subTabId, 
                                icon: "standard:knowledge",
                                iconAlt: "Debt Account"
                            });
                        });
                    });
                }

enter image description here

0

I fixed the issue. Browser tab name/title depends on focused tab/subtab label.

Even though I was setting the subtab as a focused tab but still browser title was still showing as "Loading...".

so, in the script, I have added 2 new lines to set the focused tab the parent tab and again focused it back to the subtab.

workspaceAPI.focusTab({tabId : enclosingTabId});
workspaceAPI.focusTab({tabId : subtabId}); 

Entire script:

workspaceAPI.getEnclosingTabId().then(function(enclosingTabId) {
            workspaceAPI.openSubtab({
                parentTabId: enclosingTabId,
                pageReference: {
                    type: "standard__component",
                    attributes: {
                        "componentName": "c__CustomComponent"
                    },
                    state: {
                        c__param1: recId,
                        c__param2: objName
                    }
                },
                focus: true
            }).then(function(subtabId) {
                // the subtab has been created, use the Id to set the label
                workspaceAPI.setTabLabel({
                    tabId: subtabId,
                    label: "SubTab Label Name"
                });

                // the subtab has been created, use the Id to set the icon
                workspaceAPI.setTabIcon({
                    tabId: subtabId, 
                    icon: "standard:knowledge",
                    iconAlt: "SubTab Label Name"
                });
                workspaceAPI.focusTab({tabId : enclosingTabId});
                workspaceAPI.focusTab({tabId : subtabId});                                
            }).catch(function(error) {
                console.log("error");
            });
        });

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.