function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AndrewTaylorAndrewTaylor 

Lightning Experience Button to Open New Window

I'm migrating an org from Classic to Lightning Experience, where the Detail page currently has a button that opens a Visualforce page (rendered as a PDF, e.g. /apex/myPdf?id={record.Id}) in a new window

In Lightning Experience, the detail page button will open the URL in the same window (despite behaviour being set to Display in new window). The only solution I've found so far would be to use a Lightning Component as an Action, and in the init method, open a new window. This part is fine, but then if the user returns to the original window (record page), they will see the modal still open.

From what I've read so far, if I want to auto-close the modal (i.e. $A.get("e.force:closeQuickAction").fire()) I cannot do that in the init method, so I would have to call this asynchronously (e.g. https://salesforce.stackexchange.com/questions/189248/forceclosequickaction-not-working ).

Is this really the only way to accomplish this? It seems like an overly complicated implementation to do something which seems very trivial (open a new window).
shalini sharma 24shalini sharma 24
Hi,

Did you find the solution for this? I too have a similar requirement where on the click of button i am redirection to the new lightning component using e.force:navigateToComponent. But i want this new component to open in a new window. 
AndrewTaylorAndrewTaylor
Hi Shalini;

I ended up creating a custom lightning component using the approach described in my post (have an asynchronous method that opens the new window, and then calls e.force.closeQuickAction to close the modal. 

 
Sourabh Patidar 27Sourabh Patidar 27
Hi,
Did soemone find a quick solution for this or we still have to go through the above mentioned workaround?
Atosi MalakarAtosi Malakar
Hello,
you can create a details page button like below:

User-added image

Then add this in page layout