I have a need similar to the one in this post, but I'm wondering if I can accomplish it through apex code. Essentially what I'd like to do is:

  1. When installation of the managed package completes, execute an apex script using the InstallHandler interface
  2. Within that script, remove all the tabs from an app contained in the managed package, except for a "setup" tab
  3. The "setup" tab would allow the user to save some necessary info, and then upon saving it would re-add the other tabs to the app

The difficulty I'm having is finding the right apex objects to modify. Are apps and tabs available and modifiable through apex?

1 Answer 1


Tabs API Status

While there is a means to list the tabs in Application from Apex via describeTabs, there is no means to update these from Apex. You may be able to do this via the Metadata API (which is a SOAP API) by calling it from Apex using the update operation with the CustomApplication metadata type. However doing so from an InstallHandler requires the Remote Site be setup to permit (ironically) the callout to the Metadata API and since this differs based on the subscriber org instance, its hard to predict and thus package the required Remote Site setting to make this work.


Your use case is a common one however, in that you want the user to go through some Setup and configuration before they attempt to use your application. These are a few points to consider that will help address this use case.

  • When users install your package, have them install and make visible only to the Administrator, this is an option available during the installation wizard.
  • Make the Setup tab in on application the default tab or utilise a Configure link
  • Utilise an InstallHandler to send them a link to the Setup tab / page after install
  • Leverage Permission Sets to allow the Administrator to easily enable visibility of the tabs to their end users once the Setup has been completed.
  • If you want to go to further lengths to prevent access to your app, you may want to consider a protected Custom Setting flag that contains the Setup state of your application, which can be referenced by key pages and an appropriate message be displayed. Though generally you should aim for your app to fail gracefully when setup steps have not been performed.

I hope some of these thoughts help you!

You must log in to answer this question.

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