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
AbAb 

Custom button to popup a VF page

Hello,

I have a custom button like below.
I want to open the Vf inside a popup or new window, how can i achieve it.
User-added image

Thanks
Best Answer chosen by Ab
Krishna SambarajuKrishna Sambaraju
Hello Sandrine,

To open a VF page in a popup you need to select the Behaviour for the button as "Execute Javascript" and add the javascript in the text area as below.

window.open('/apex/test','mypopup','top=150,left=200,location=1,status=1,scrollbars=1, width=500,height=600'); 

Hope this helps.

All Answers

Shashikant SharmaShashikant Sharma
Make your VFP to use Standard Controller the object where you are using this popup. like if it is account then 
 
<apex:page StandardController="Account" >
Chose content source as VFP and select the page you want to open in popup.

Otherwise you could chose Execute Java Script and use Window.open( java script method to open it in popup.

Thanks
Shashikant
AbAb
If i change, anything from aobe, i dont see the custom button to add on a layout.
Is there a tutorial where it uses List button and visualforce page.

I dont use standard object, it is can be contoller="cuntom__c"
Krishna SambarajuKrishna Sambaraju
Hello Sandrine,

To open a VF page in a popup you need to select the Behaviour for the button as "Execute Javascript" and add the javascript in the text area as below.

window.open('/apex/test','mypopup','top=150,left=200,location=1,status=1,scrollbars=1, width=500,height=600'); 

Hope this helps.
This was selected as the best answer
Christopher D. EmersonChristopher D. Emerson
Same here - seems like Execute Javascript option is deprecated to some extent. Still searching for way to get a VF page to open as a modal popup.