I want to know is it possible to include the JavaScript custom button on visual-force page.

for e.g. we can include the delete button like

<apex:commandButton action="{!URLFOR($Action.Opportunity.delete,id)}" value="Delete" />
  • yes you can add this.
    – Himanshu
    Jan 21, 2016 at 17:59

1 Answer 1


It is not possible to include a custom button on a Visualforce page. The closest you can get is to either replicate the functionality with an <apex:commandButton /> or to move the javascript functionality into a static resource, then include that resource in your custom button using {!REQUIRESCRIPT()} and include it on your visualforce page by using <apex:includeScript />, then wire it to an <apex:commandButton />. This second approach might involve more overhead (and some refactoring of your button javascript), but saves you from having to update the same code in two places.

You must log in to answer this question.

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