1

On a custom tab I have a LWC component that wants to use NavigationMixin to reference another custom tab. In my Controller I have defined that call like this:

import { NavigationMixin } from 'lightning/navigation';

export default class componentName extends NavigationMixin(LightningElement){
    clickReturn(evt) {
        this[NavigationMixin.Navigate]({
            type: 'standard__navItemPage',
            attributes: {
                apiName: 'Name_of_tab'
            }
        });
    }
}

And instead of redirecting me to the custom tab, it embedes the js code on the url leaving it like this:

mysandbox.lightning.force.com/lightning/cmp/clickReturn(e)%7Bthis%5Bu.NavigationMixin.Navigate%5D(%7Btype%3A"standard__navItemPage"%2Cattributes%3A%7BapiName%3A"Configuracion_de_descuentos"%7D%7D)%7D

1 Answer 1

3

You have to put apiname

Here is the code i used for my requirement and it works properly

Here is the link for your reference

import { LightningElement, api} from 'lwc';
import { NavigationMixin } from 'lightning-navigation';


export default class Navtab extends NavigationMixin(LightningElement) {
    @api tabName;
    @api label;
    navigateNext() {
        this[NavigationMixin.Navigate]({
            type: 'standard__navItemPage',
            attributes: {
                apiName: this.tabName,
            }
        });
    }

}

Here tab name is your custom tab name .

2
  • I already had this included and still does not work (already edited the question), sorry for that Jan 13, 2020 at 9:35
  • CustomTabs from managed packages are identified by their, namespace prefix followed by two underscores followed by the developer name. E.g. 'namespace__TabName'. Try this Jan 13, 2020 at 10:41

You must log in to answer this question.

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