I'm creating an application that will be distributed as a managed package on the AppExchange. As part of the install process, I would like to override some standard links/buttons for standard objects (Accounts and Contacts, possibly others) to use a custom VisualForce page that I will include with my package.

Is it possible to override the standard New/List links via Apex code run in the InstallHandler implementation? Or will I need to have users do that manually after app install?

3 Answers 3


Yes this is possible, and no you do not even have to run code to do it. If you simply define the action/button overrides and include them in your package, these changes will automatically be applied to the org during install. EDIT: due to being standard action on standard objects, these still require a manual activation after install.

As a side-note, there is no native method of doing this sort of metadata manipulation directly in Apex; anything like that needs to be done through the Metadata API. If that's the route you want to go, Andrew Fawcett has produced a Apex-wrapper for the Metadata API and gives some basic tutorial for it here: http://andyinthecloud.com/2013/10/27/introduction-to-calling-the-metadata-api-from-apex/

  • Thanks...I think I understand what you're saying but I don't know quite what to put in the package to make it happen. I've created a VF page and assigned it as the Account New action via Customize->Accounts->Buttons, Links and Actions. I can put the page in my package. Do I then add the NewAccount action to my package as well? I'm not seeing anything that looks like an "add custom action" option in package admin.
    – jscott
    May 22, 2015 at 12:02
  • 1
    Yes that's correct. In the packaging admin, you'll find these under the Action category (top of the list) May 26, 2015 at 14:12
  • Well, I tried adding the NewAccount action to the package, but when I tested the install on a second dev instance, the New Account action didn't show my custom VF page. Is there something else I need to add to the package?
    – jscott
    May 26, 2015 at 19:19
  • Since it overrides the standard action of a standard object, I think you have to go and activate it in the installed org. If you view the Account object's actions,your override should be there, just waiting to be turned on. May 26, 2015 at 19:48
  • True, if I go Customize->Accounts->Buttons, Links, and Actions, the VF page from the package is listed there and I can select it. But that doesn't seem to be any different than just putting the VF page in a package without the action. If that's the way it is, then so be it, but I was hoping to be able to wire that up without customer intervention.
    – jscott
    May 26, 2015 at 20:44

RenegadeCoder's answer got me close. The apex-mdapi package now includes a RemoteSiteHelper component that shows how to make a post-install page that contains a button to perform the remote site setting add. A slight modification of that can be used to call the metadata API to add the custom action. It can't be fully automated in the InstallHandler because the remote site setting has to exist before the metadata callout will succeed. But a post-install page at least puts it in front of the installing user.


I think it is possible. But you need to add standard objects in your managed package.

  • 1
    Thanks. Can you tell me where to find the documentation for the Apex method to do this? I've been searching but haven't found anything yet. Also, I see where I can add a Custom Object to a package, but not a standard object. Do you know how to do that?
    – jscott
    May 21, 2015 at 17:41

You must log in to answer this question.

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