How can the workspace API's "open tab" functionality be achieved with lightning web components? I've only seen this functionality described for aura components in the documentation.

2 Answers 2


Looks like official support for this is coming out soon, it was flagged for Summer 20 but I don't see support for it yet. https://help.salesforce.com/articleView?id=lex_roadmap.htm&type=5

In the mean time you can manually generate the URL needed to have LEX open the page in a subtab. Here is code for opening the new page for a custom object and passing in default field values.


        let defaultValues = {
            'Parent__c' : recId



        let defaultValuesEncoded = encodeDefaultFieldValues(defaultValues);
        let subTabURL = '/lightning/o/'+obj+'/new?nooverride=1&count=2&defaultFieldValues=';
        subTabURL += defaultValuesEncoded+'&ws='+encodeURIComponent(window.location.pathname+'?count=1')+'';

        let temp = {
            type: 'standard__webPage',
            attributes: {
                url: subTabURL



There isn't one yet that I'm aware of. The best option today is to wrap your LWC in an Aura component, and then communicate between the Aura/LWC component via Lightning Messages or other events/attributes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .