Tuesday, December 31, 2019

How To Open Visual Force Page From LWC Components

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

  const urlWithParameters = '/apex/YourVisualPageName?prop1=propval';
  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.

Hope this helps you..Enjoy..!

No comments:

Post a Comment