I have a Visualforce page that contains a link to a custom report. I'm generating that link in an apex class like this:
reportUrl = '/' + reportId
Then in the VF page I create the link and add the filter:
<apex:outputLink value="{!reportURL}" target="_blank">
Open Report
<apex:param name="fv1" value="{!URLENCODE(userName)}"/>
</apex:outputLink>
This worked well SF Classic where the parameter name in the VF code had to be "pv1". In Lightning that has changed to "fv1". Now when I generate the URL it looks just like the classic version but with the "fv1" as expected. However, when I click on the URL in Lightning it redirects and I end up with a different URL that takes me to the report but doesn't include the filter parameter.
Generated URL: https://my_domain.my.salesforce.com/00O40000003SdKeEAK?fv1=Bob%20Smith
Redirected URL: https://my_domain.lightning.force.com/lightning/r/Report/00O40000003SdKeEAK/view
If I take the redirected URL and manually add the "?fv1=Bob%20Smith" then the filter shows up so I know the Lightning report works with the filter parameter.
Is there a way to get the Lightning version of the URL from the Apex class so I can append the filter parameters to that?