Background: I am trying to redirect a user from an external site to my salesforce visualforce page with a GET query param as part of the URL. (This is part of a managed package)
I want that parameter to be passed to my apex code so that I can do stuff with it on the server-side (after validating that it is what I expect, etc. of course).
What I have tried so far:
Unfortunately, I haven't been able to see the get param in my apex code using either of those strategies.
I am concerned that there may have been a change to how query params work in the Summer '19 update (https://releasenotes.docs.salesforce.com/en-us/spring19/release-notes/rn_forcecom_general_namespace_prefix_cruc_reminder.htm) so that they don't get passed through, even if I am using a namespaced get param. (I tried both the c__
and the <my managed package namespace>__
, but other than continuing to see the param in the address bar, it hasn't helped.
In particular, when doing a sanity check, even though I can see the get param in the address bar after visiting the page, I noticed that I can't get the get parameter to be available to javascript running in the VF page:
When I go to https://<scratch org namespace>.lightning.force.com/lightning/n/MyCustomPage?mypackagenamespace__parameter=helloworld
I would expect to be able to see the mypackagenamespace__parameter
param get printed to the console using this javascript:
<script>
window.onload = function(){
console.log(window.location.search);
}
</script>
But instead, I am seeing a completely different URL and set of SFDC parameters:
?sfdc.tabName=<SFDC id>&vfRetURLInSFX=%2Fhome%2Fhome.jsp<n_app_id=<SFDC id>&nonce=<nonce code>&sfdcIFrameOrigin=https://<scratch org namespace>.lightning.force.com&tour=&isdtp=p1&sfdcIFrameHost=web&clc=0
Now for my question:
Does anyone know why this is happening and how I can make it so that my GET param can be appropriately passed through to make it to my server-side code?
Update:
I just tried to go to https://<scratch org namespace>.visualforce.com/apex/MyCustomPage?mypackagenamespace__parameter=helloworld
instead of the lightning/n/MyCustomPage
version and it worked.
Is there a way to make it work with the original URL, or do I just need to make sure to adjust the URL target to use the apex/MyCustomPage
format?
/n/
named tab URL.