[SalesForce] How to append new tab to the list of selected tabs for all users and apps

I have a VisualForce tab that is included in my managed package. I have also created a Permission Set for the VisualForce tab that makes the tab visible and available. When I created the tab, the tab visibility was set to "Default On" for all profiles. I also included the tab on all custom apps in my org and checked "Append tab to users' existing personal customizations". In the dev org that this tab was created in, the tab is visible for all custom apps and was appended to the user's list of selected apps.

The permission set and the VisualForce tab (and the VisualForce page that the tab displays) are all included in the managed package. When the package is installed on a test org, the tab is available in the "All Tabs" section to admins and users with the associated permission set. They can also select "Customize My Tabs" and add the tab to their list of selected tabs for whatever app they want.

I want the managed package to "Append tab to users' existing personal customizations" when it is installed. Is that possible? Do I need to create a post-install script for my package? Is there a way that an org admin could easily do this? if so how? Ideally this would be handled by the package installation or by some apex run after installation. I am also interested in hearing about other solutions and learning about tab management in general.

thanks in advance for your help.

Best Answer

As per my comment. You could use an App as part of the managed package that includes the new Tab. Then, when users select your App they will get the tab.

Personally, I don't think installing a managed package should reach out and add a tab to all the installed Apps.

That said, on install of the managed package you could for force all the users into your permission set that makes the tab visible.

List<PermissionSetAssignment> psas = new List<PermissionSetAssignment>();
for(User u : someUserList) {
    PermissionSetAssignment p = new permissionsetassignment();
    p.assigneeId = u.Id;
    p.permissionsetId = permissionSetId; 
    psas.add(p);
}
insert psas;

Alternatively, edit the profiles and use the Overwrite users' personal tab customizations in the Tab Settings.

Override users' personal tab customizations

Related Topic