I have a requirement to create a custom button that will open a pop up window with some options to select. Currently i've built a VF page and called it from the custom button. But i need to expose this button in different detail page and if we call VF page from custom button, i need to use standard controller of one particular object..and cannot be reused for other related object. So i want the popup window to be opened when we execute onclick javascript from custom button, like : window.open=('/apex/newRic?id={{item.id}}','blank'); . But then i'm not able to add window open property to that button to specify the size of the popup


public class test_k {
  Public string s{

  public test_k(ApexPages.StandardController controller) {
  public List<SelectOption> getMatrix() {
    List<SelectOption> options = new List<SelectOption>();
    options.add(new SelectOption('None','----None----'));

    list<Account_List_vod__c> pv= [select name,id from Account_List_vod__c];
    for (Account_List_vod__c p:pv) {
      options.add(new SelectOption(p.id,p.name));
    return options;

public void addlineItem() {


<apex:page standardController="Account" showHeader="false" extensions="test_k" sidebar="false">
    <apex:selectList value="{!s}"  multiselect="false" size="1">
      <apex:selectOptions value="{!Matrix}"/>
    <apex:commandButton value="OK" action="{!addlineItem}"/>

enter image description here

1 Answer 1


If you want to use Javascript you will need to convert the button. Set the behaviour to "Execute JavaScript" and Content Source to "OnClick JavaScript"

enter image description here

  • If i use onclick javascript in custom button i'm not able to set window open property, which is doable in case of custom button in VF page
    – user59759
    Commented Oct 14, 2015 at 8:45
  • 1
    You can use the following:window.open(URL, '_blank', 'height=600,width=600,resizable=yes,scrollbars=yes,toolbar=no,menubar=no'); I have copied the same properties that you have used above, also see here this w3schools.com/jsref/met_win_open.asp for details on window.open()
    – Tim
    Commented Oct 14, 2015 at 9:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .