function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phil WPhil W 

How can I open a Visualforce page from a Lightning Web Component and pass it query parameters?

There's documentation and a number of articles about how you can have an LWC component open a page, including with query parameters (such as this one (https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.use_navigate_add_params_url) from the official documentation). There's also documentation about how you open different types of page, though the NavigationMixin doesn't support direct VF page access.

It appears that, while we can set up a custom tab that wraps the VF page, the VF page is then embedded in an iframe and, due to the lightning and VF pages residing on different domains, there's no communication possible across the iframe boundary (so the query parameters are not visible).

I need to be able to open a VF page from an LWC and pass it several query parameters. My issue is that none of the mechanisms explain how I can get the base URL for a VF page that will work from my LWC (I need to do this for standard and community portal usages).

There's even an article, here (https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html), that discusses the basic issue (at least in the Aura context). Unfortunately it entirely glosses over how to get the URL for the VF page, simply saying:
 
"vfHost is the host Visualforce pages are loaded from in your environment. In a real-life application, you should obtain this value dynamically instead of hardcoding it"

Do you know how I can obtain the VF page URL in a robust and automatic way from Salesforce (since this component will be part of a package I can't hard-code the access)?
SFDC Traning 6SFDC Traning 6
in Aura enabled method of LWC you can call vf page
PageReference pageobject = Page.VFPagename;
with pageobject you can call the parametern in aura method and set to lightning vice versa 
Phil WPhil W
@SFDC Traning 6, thanks for the suggestion. I'll give it a try and see if it works!
SidViciousSidVicious
To those stuck with the same problem, @Phil W provided a workaround in here, Community-supported or not: https://salesforce.stackexchange.com/questions/268907/