I have a JavaScript button on the Opportunity Product object that needs to be converted to a Lightning Component:
window.open("../apex/ExportOLI?id={!Opportunity.Id}");
What's the best approach for this? #JS_Alternatives
Hi Maria
If you want to send the object Id to a VF page, you can do it in a custom link or button and send the Id in the url, that is supported in Lightning experience
You need to go to
Setup > Object Manager > Opportunity > Buttons, Links and Actions > New Button or Link
in behavior select "Display in new window"
in content source select "URL"
and in the formula field you add something like this:
/apex/NameOfVisualForcePage?Id={!
Opportunity.Id}
I see you are using a standard controller, you might want to use a custom one so you can capture the Id in it, you can still use the standard one inside the custom (extended controller)
In the custom controller you capture the Id with something like
public String opportunityId = ApexPages.currentPage().getParameters().get('Id');
To create the extended controller please refer here:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_extension.htmLet me know if that helps.