My requirement is open the LWC page from Aura component controller.
So I did all the steps which mentioned in the link How to open LWC in a new page from Record Detail Aura Component but getting an error "This page isn't available in Salesforce Lightning Experience or mobile app."
My requirement is a little bit different- Open the LWC page in the same window without any tab. I am using the below code in Aura component controller.
createProactiveLWC : function(cmp,event,helper){
var navService = cmp.find("navService");
// Sets the route to /lightning/o/Account/home
var pageReference = {
type: 'standard__component',
attributes: {
componentName: 'c:proactiveLWCForm'//I tried with c__proactiveLWCForm and c__c:proactiveLWCForm
},
state : {
c__recordId : cmp.get('v.recordId')
}
};
// Set the URL on the link or use the default if there's an error
var defaultUrl = "#";
navService.generateUrl(pageReference).then($A.getCallback(function(url) {
}));
}
Best Answer
URL addressable tabs
are currently not supported for LWC components as documented in Unsupported Experiences and ToolsAlso from Documentation:
So embed LWC component in Aura component and have navigation to that component - using
isUrlAddressable
interface.Also, pls note that the URL parameters are accessable in LWC component directly. You need not pass them from Aura component.
As shown above, use
wire
service to get the URL parameters (asstate
) in LWC component