How to open in lightning experience a custom visualforce page that requires parameters?

Scenario:

I have two custom visualforce pages called, reportlist and reportshow. The reportlist does not accept parameters and opens via an app’s tab in salesforce classic. The reportlist displays a table and each row has a link that opens the reportshow visualforce page with specific parameters (not URL hacks).

Also, reportshow uses third-party scripts via static resource and relies on the custom parameters for loading salesforce reports. Without parameters, reportshow will return an error.

Problem:

When I switch to lightning experience, reportlist seems to load fine, but the table links that open reportshow ends up displaying the following:

URL No Longer Exists
You have attempted to reach a URL that no longer exists on salesforce.com.

Observations:

I noticed the following difference after trying to open a reportshow:

  1. The fqdn is different on the error page compared to the url when I hover in the reportlist.
  2. The path /apex/ became /one/.

[Sample hover link]
https://ns-dev-ed–ns.na30.visual.force.com/apex/reportshow?id=00O36000002TXfdEAG&reportName=TestReport
[Sample URL in address bar of error page]
https://ns-dev-ed.my.salesforce.com/one/reportshow?id=00O36000002TXfdEAG&reportName=TestReport

Attempted fixes:

I tried prefixing apex/ to the href value in the reportlist, but hovering on the links now displays /apex/apex/ and clicking it leads me to URL No Longer Exists.

I also tried adding target="_blank" and it works as expected minus the lightning experience.

Question:

How do I open the reportshow visualforce page in lightning experience?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

This looks to be a namespace issue similar to the one described here – currently in review.

It can be reproduced using these steps as mentioned on the link

  • Create an namespace on your Developer Org and a Managed Package
  • Add the two Visualforce Pages to the package and upload it copying the link
  • Log into another organization and install the package.
  • Override the Account View with TestPage1 and then switch to Lightning Experience.
  • Navigate to any Account page and click on either the A href link or OutputLink, clicking OutputLink will work as expected maintaining the
    correct namespace, clicking on A href link will navigate to your
    default org namespace which results in either URL “No Longer Exists”
    or “Page namespace__TestPage1 does not exist”. (Behavior varies on how
    the page will display)

The suggested workaround is not ideal, but it works

1) Right click on the link and select “Open Link in New Tab”;
2)
Disable Lightning Experience;
3) Change the tag references to
make use of the Visualforce tag


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x