Please use below code snippet to open the visual force page from LWC.
import { LightningElement,api,track,wire } from 'lwc'; import { NavigationMixin } from 'lightning/navigation'; export default class CallPopup extends NavigationMixin(LightningElement) { //Call this method from your .html file openVisualForcePage(event) { const urlWithParameters = '/apex/YourVisualPageName?prop1=propval'; console.log('urlWithParameters...'+urlWithParameters); this[NavigationMixin.Navigate]({ type: 'standard__webPage', attributes: { url: urlWithParameters } }, false); //if you set true this will opens the new url in same window } }
Note: The lightning-navigation works only in lightning experience and it will not work even if your rendering your component in vf page (using lightning-out) in lightning experience or classic experience.
Did you execute this code ? it should not work
ReplyDeleteWhat is the happening? Getting any error ..Please read the note in the last for more info.
Delete