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 using rendering your component in vf page (using lightning-out) in lightning experience or classic experience.
No comments:
Post a Comment