Navigate from Lightning Web Component to another LWC or AURA component Salesforce | LWC Stack ☁️⚡️

Поділитися
Вставка
  • Опубліковано 13 тра 2022
  • In this video I will share two ways to navigate from a Lightning Web Component to another Lightning Web Component.
    Navigate using AURA Component - In this method we will embed our Lightning Web Component in an AURA component. We will use aura because for redirection we will be using isUrlAddressable which is available in aura only. So technically it's more over like redirecting to an Aura component which is embedding LWC inside it.
    Navigate without AURA Component - In this method we will use the one.app url to redirect to the target LWC. We will convert the component definition to a base64 encoded string first then we will pass the data in the url itself.
    In this demo I will create 3 components -
    1. navigateFromLWC - The source component from which we will be redirecting to another LWC component.
    2. navigateToLWC - The target component to which we will make the redirection.
    3. navigateToLWCAura - Aura component which will embed navigateToLWC.
    #Navigation #Salesforce #LWC
    Join me on Instagram : / iamkapilbatra
    Blog : www.salesforcebolt.com/2022/0...
    Website : www.salesforcebolt.com​​
    LinkedIn : / salesforcebolt
    Twitter : / salesforcebolt​​
    Facebook : / iamsalesforcebolt

КОМЕНТАРІ • 31

  • @akankhsasingh1376
    @akankhsasingh1376 Рік тому +1

    Thanks so much i was stuckin this part and i was trying to figure it out now because of you i was able to do

  • @vindhyasravan8256
    @vindhyasravan8256 Рік тому +1

    Thank u so much.

  • @clintonpereira9332
    @clintonpereira9332 2 роки тому +1

    can we navigate to certain portions of the same page,like having an anchor tag which onclick will take you to the footer section

    • @SalesforceBolt
      @SalesforceBolt  2 роки тому

      Have you tried it using #sectionName as container id and use the same in anchor tag?

  • @satyabratamohanty9173
    @satyabratamohanty9173 4 місяці тому

    User
    Can we pass param values when we navigate from one LWC to another LWC without aura ?

  • @arnabchoudhury1743
    @arnabchoudhury1743 9 місяців тому

    How to pass attribute in navigate without aura

  • @user-ky3cs2so6w
    @user-ky3cs2so6w Рік тому

    @SalesforceBolt it is not working in community, How to fix that ?

  • @furkanalemdaroglu3510
    @furkanalemdaroglu3510 Рік тому +1

    i wanna navigate my lwc to receord page with record Id but i could not can help me
    this is js :
    closeLwc() {
    this[NavigationMixin.Navigate]({
    type: "standard__recordPage",
    attributes: {
    recordId: this.recordId,
    objectApiName: "Account",
    actionName: "view"
    }
    });
    }
    this is aura

    • @SalesforceBolt
      @SalesforceBolt  Рік тому

      Hi there, checkout solution on below link
      salesforce.stackexchange.com/questions/356879/how-to-pass-url-parameters-to-a-lightning-app-page-to-load-lwc-in-context-of-a

  • @user-sk2fo9oj6q
    @user-sk2fo9oj6q 8 місяців тому +1

    can't we redirect from lwc to lwc directly ?I mean why we need to add destination lwc component in aura component ??

    • @SalesforceBolt
      @SalesforceBolt  8 місяців тому

      You need to redirect on the page/app where you are having your lwc. If it’s on the same page then you should maintain the rendering.

  • @ankushsonone1087
    @ankushsonone1087 2 роки тому +2

    can we navigate to one aura component to another aura component

    • @SalesforceBolt
      @SalesforceBolt  2 роки тому

      Yes we can. Checkout below space
      developer.salesforce.com/docs/component-library/bundle/force:navigateToComponent/documentation

  • @dunglehoang9203
    @dunglehoang9203 2 роки тому

    How I add parameter to URL when navigate to LWC?

    • @SalesforceBolt
      @SalesforceBolt  2 роки тому

      Check this link below for reference :
      salesforce.stackexchange.com/questions/356879/how-to-pass-url-parameters-to-a-lightning-app-page-to-load-lwc-in-context-of-a

    • @dunglehoang9203
      @dunglehoang9203 Рік тому +1

      @@SalesforceBolt thank you so much!

  • @fiketraining4853
    @fiketraining4853 Рік тому

    Launching in a modal the component?

    • @SalesforceBolt
      @SalesforceBolt  Рік тому

      Sorry I didn't get it, could you please elaborate?

    • @nickstoliker8707
      @nickstoliker8707 Рік тому

      @@SalesforceBolt I am looking to implement an action in a Sortable Data Grid (unofficial Salesforce), that launches a component in a modal pop up. Similar to how quick actions work, but from an action embedded in an enhanced lightning grid. With you solution it opens in a new page, could this be modified to throw a modal?

  • @onarocks77
    @onarocks77 Рік тому +1

    After navigating to another LWC the new component is not refreshing , not showing the latest data, any idea how to resolve this?

    • @SalesforceBolt
      @SalesforceBolt  Рік тому

      Are you wiring your methods?

    • @onarocks77
      @onarocks77 Рік тому

      @@SalesforceBolt yes.I had to use another button on the new component to refresh using refreshapex

  • @sanjaynarise7446
    @sanjaynarise7446 Рік тому +1

    How to do in reverse way from aura to lwc ??

    • @SalesforceBolt
      @SalesforceBolt  Рік тому

      Is it embedded?

    • @sanjaynarise7446
      @sanjaynarise7446 Рік тому +1

      @@SalesforceBolt by clicking button on aura component we need to navigate to lwc component. Please let me know if any video like this. Thanks

    • @SalesforceBolt
      @SalesforceBolt  Рік тому +1

      @@sanjaynarise7446 That seems like a limitation. A work around would be to embed your LWC in another aura component and navigate to that.

    • @sanjaynarise7446
      @sanjaynarise7446 Рік тому +1

      @@SalesforceBolt thank you👍👍