I have created a button "Make Donations" for an object Donations__c by going

setup-->Create-->Objects-->Donations__c-->Buttons, Links, and Actions-->New Button or link.

How to add this button in a vf page.


  • i believe the custom buttons are meant only for standard page layouts. you have to create a new command button in your VF page and replicate the logic. Jul 20, 2015 at 7:09

1 Answer 1


Hello Sid May this would be helpful...

<apex:commandButton action="{!URLFOR($Action.YourObjectName__c.YourCustomButtonAPI_Name__c, Id)}" id="Button" value="ButtonLabel"/>
  • Hi Amit .. If i need to open a vf page in a new window on button click.How to do it in <apex:commandButton action="{!URLFOR($Action.YourObjectName__c.YourCustomButtonAPI_Name__c, Id)}" id="Button" value="ButtonLabel"/> Jul 20, 2015 at 7:43
  • You can use apex:outputLink which have target attribute which can be specified to _blank to open the link in new window. But you need to use css to style the apex:outputLink to look like a apex:commandButton. Jul 20, 2015 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.