Tuesday, May 12, 2020

Navigate to Visualforce page from lightning web components(lwc)

To navigate to visualforce page we have to use the Navigation Service in Lightning web components.

Check below for more details about navigation service in Lightning web components

Sample Code

//Navigate to visualforce page
navigateToVFPage() {
    this[NavigationMixin.GenerateUrl]({
	    type: 'standard__webPage',
	    attributes: {
		    url: '/apex/SampleVFPage?id=' + recId
	    }
    }).then(vfURL => {
	window.open(vfURL);
    });
}

1 comment:

  1. Hi,
    Could you please tell me how can we define URL in vfURL, actually I am new to LWC so dont know.

    ReplyDelete