I am having an issue with the focus feature in the openSubtab method of the workspaceAPI and was wondering if this is working as intended or not. I am following the developer documentation from this link:


<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <lightning:workspaceAPI aura:id="workspace" />
    <lightning:button label="Open Tab with Subtab" onclick="{! c.openTabWithSubtab }" />
    openTabWithSubtab : function(component, event, helper) {
        var workspaceAPI = component.find("workspace");
            url: '/lightning/r/Account/ACCOUNT_ID_HERE/view',
            focus: true
        }).then(function(response) {
                parentTabId: response,
                url: '/lightning/r/Contact/CONTACT_ID_HERE/view',
                focus: true
        .catch(function(error) {

What I am expecting this to do when clicked would be to open the tab for the Account with a subtab for the Contact and have it be focused on that subtab. If you have focus: false for the openSubtab then it will open everything correctly and not focus on the subtab, as expected.

What is happening with focus set to true:

  • If you click on the button when the parent tab is not opened at all in your console, then it will open that tab but NOT the subtab (I think an error with the focus:true is preventing this)
  • If you go back and click the button again with the parent tab open (does not have be focused), then it will focus on the parent tab, open the subtab, and focus on the subtab.

Is this working as intended? And if it is, does someone have an idea of how I could achieve what I want to do with opening up the parent tab for the first time, subtab, and focusing on the subtab? I've tried nesting another openTab call inside the first one but that does not work. Any help would be appreciated. Thanks!

  • What you implemented is correct and its actually working fine with exactly same code you showed in question. working for both scenarios you explained. Can you give any more information? – salesforce-sas Sep 23 '19 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.