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
AbAb 

NavigationMixin is not retreived by workspace api

Hello,

I have below function , when users clicks, 
a new sub tab is opended and the URL is retrived by lightning workspace api which gets the correct url.

But when users clicks on it second time, it get the URL of the tab instead of subtype
fnname(event){ 
                this[NavigationMixin.Navigate]({
                        type: 'standard__objectPage',
                        attributes: {
                                objectApiName: 'Account',
                                actionName: 'new'
                        },
                        state: {
                                recordTypeId:t001XXX
                        }
                });

how can i force the worksapce API to get the correct url paramenter

thank you for suggestion
Best Answer chosen by Ab
AnudeepAnudeep (Salesforce Developers) 
Hi Sandrine, 

Why don't you try the following instead to get the subtab info?
 
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
    <lightning:workspaceAPI aura:id="workspace" />
    <lightning:button label="Get Opened Tab Info" onclick="{! c.getOpenedTabInfo }" />
 </aura:component>

({
    getOpenedTabInfo : function(component, event, helper) {
        var workspaceAPI = component.find("workspace");
        workspaceAPI.openTab({
            url: '/lightning/r/Account/001xx000003DI05AAG/view',
            focus: true
        }).then(function(response) {
            workspaceAPI.getTabInfo({
                tabId: response
            }).then(function(response) {
                console.log(response);
            });
        })
        .catch(function(error) {
            console.log(error);
        });
    }
})

Reference: https://developer.salesforce.com/docs/atlas.en-us.api_console.meta/api_console/sforce_api_console_lightning_getTabInfo.htm