Seemingly simple... In Classic I can add a button to the top of a record detail page that I can define a Visualforce page I want to open, that has the sObject set as the standard controller. In Lightning Experience, how do I achieve this? I want a button that I can click that will open a custom VF page and have the Id passed as a param in the URL.
1 Answer
So figured this out, and it's a bit clunky if you ask me.
- Create a VF page that uses the sObject as the StandardController
- Create an Action on the sObject that opens the page you just created
- In the controller, create a method that returns a PageReference to the VF page you actually want to go to, and pass add any parameters there.
- On the VF page, set the method you created as the Action property in the element, like Action={!goToPage}
The downside, you get this big empty modal that pops up for a second before actually redirecting you. The modal has action buttons at the bottom as well... which you can't get rid of.