Thursday, 21 November 2024

Navigate from one app to another in Lightning Web Components

 New in Winter ’20 is the ability for developers to use the navigation mix-in to direct users to an App, or a page specifically within an app.


import { LightningElement } from 'lwc';

import { NavigationMixin } from 'lightning/navigation';

export default class NavToApp extends NavigationMixin(LightningElement) {

  navigateToApp() {

    // Use the built-in 'Navigate' method

    this[NavigationMixin.Navigate]({

      type      : "standard__app",

      attributes: {

        appTarget: "Sales",

      }

    });

  }

}


You can now specify a type of standard__app and provide an appTarget key with the name or ID of the application ID.

No comments:

Post a Comment