I have a LWC which navigates to records using NavigationMixin. When I use the same LWC in VisualForce page using lightning out, the navigation does not work. I there any way to make it work? I did research but didn't find any guidance. Please help.
navigateToRecordViewPage(event) {
this.record = event.detail.row;
// View a custom object record.
this[NavigationMixin.Navigate]({
type: 'standard__recordPage',
attributes: {
recordId: this.record.id,
//objectApiName: 'Lead', // objectApiName is optional
actionName: 'view'
}
});
}
Best Answer
First check if you are in lightning or classic. If in lightning, use navigation.mixin. If in classic, use window.location.assign().