1

aura:application

<aura:application extends="force:slds" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:hasSObjectName" access="global">
    <c:World></c:World>
</aura:application>

aura:component

<aura:component  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction,lightning:actionOverride,force:hasSObjectName" access="global">
    <c:LWC  recordId="{!v.recordId}"></c:LWC>
</aura:component>

LWC

import {
    LightningElement,
    api,
    track,
    wire
} from 'lwc';

import {
    NavigationMixin
} from 'lightning/navigation';

export default class WesLWC extends NavigationMixin(LightningElement) {
    @api recordId;
    backtoOppRecPage() {
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: {recordId},
                objectApiName: 'Opportunity',
                actionName: 'view'
            },
        });
    }
}

< c:LWC > Is lightning web component So I want to pass record id from lwc to aura application how can I do this

9
  • Can you post the code for your LWC? The way you are passing it from the application is correct. Did you get any error? Oct 31, 2019 at 10:55
  • I have added you can see now
    – mohd areeb
    Oct 31, 2019 at 10:59
  • So when i click on backtoOppRecPage() button which in my template it doing nothing when click from application
    – mohd areeb
    Oct 31, 2019 at 11:00
  • ok and how are you passing that record id to your aura app? Oct 31, 2019 at 11:05
  • that is i want to know
    – mohd areeb
    Oct 31, 2019 at 11:05

1 Answer 1

0

You need to define the parameter in the lightning application and pass it using the app URL. This is how you can define it.

<aura:application extends="force:slds" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:hasSObjectName" access="global">
    <aura:attribute name="recordId" type="String"/>    
    <c:LWC recordId="{!v.recordId}"/>
</aura:application>

This is how you pass it, say your application name is TestApp and you are passing 0030K00001LW1hMQAT to recordId.

https://mydomain11-dev-ed.lightning.force.com/c/TestApp.app?recordId=0030K00001LW1hMQAT

5
  • This page has an error. You might just need to refresh it. [PromiseRejection: [object Object]]
    – mohd areeb
    Nov 1, 2019 at 5:36
  • it is showing this error
    – mohd areeb
    Nov 1, 2019 at 5:36
  • Here to pass direct LWC to aura application
    – mohd areeb
    Nov 1, 2019 at 5:43
  • like this we can do or we have to pass LWC first into Lightning Component then in aura application
    – mohd areeb
    Nov 1, 2019 at 5:43
  • you can pass directly to Lwc from Aura application Nov 1, 2019 at 8:58

You must log in to answer this question.

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