[SalesForce] How to override default contacts tab with custom visualforce contacts tab

BACKGROUND

Run into an issue implementing the answer to this question, How to recreate Contact, Account, & Opportunity homepages with Visualforce pages? – that being:

There appears to be a "bug" with this approach, though it's not a deal
breaker for me; meaning I still plan to use this approach in part
because as a result of the bug being present on 100% of the tabs
displayed, it's less noticeable. So, bug is that the "real" accounts
tab, which is hidden, is the tab that's shown as being active, even
though it's not; meaning if you have the real & custom tabs displayed,
click the custom tab, the real tab is highlighted as being selected
even though it is not. Played around with both the code, tab-names,
etc. and nothing appears to fix this.

eyescream was kind enough to reply my comment saying:

I thought you were going to override the standard tab with this? Go to
Setup > Accounts > Buttons, Links and Actions and hit "Edit" next to
"Tab". Change the code to (no std controller specified) and it should become
selectable. If you still need server-side checks – just use regular
controller and not an extension class.

Thing is there appears to be a few issues, first issue being that I'm unable to get it to work, and the next being that it appears there's some code in the "Setup > Build > Customize > [Accounts,Contacts,Opportunities] > Buttons, Links, and Actions" that is from the Nonprofit Starter Pack. As such, give these appears to be more of a new question, than a request for clarification, and it's likely that you seeing what I'm seeing would be of use, I've posted a new question.

Efforts Made

(1) Updated the Visualforce code for the custom contact tab/page by replacing <apex:page standardController="Account" readonly="true"> with <apex:page readonly="true" tabStyle="Contact">

enter image description here

Here's the text version of the code above if it's of use:

<apex:page readonly="true" tabStyle="Contact">
    <apex:sectionHeader title="{!$objectType.Contact.LabelPlural}" subtitle="Home"/>
    <apex:ListViews type="Contact" />
</apex:page>

(2) Modified the contact tab configs here, "Setup > Build > Customize > Contacts > Buttons, Links, and Actions" by selecting "Override With: Visualforce page", selecting the related Visualforce page, and saving the change:

enter image description here

(3) Moved the custom tab next to the default tab and tested to see if the bug was fixed by clicking the home tab, then the custom tab; the result was that the page for the custom tab was displayed, but the tab for the default contact page was highlighted.

Here's a pic of what I'm seeing, the default contact tab is on the left, and the custom contact page tab is on the right:
enter image description here

Nonprofit Starter Pack Customizations

As mentioned above, there are some Nonprofit Starter Pack (which are managed packages from the Salesforce Foundation) listed within the over item in "Setup > Build > Customize > Contacts > Buttons, Links, and Actions" but the default-tab-override item was set to the default, so I'm guessing that the other code is unrelated to the current issue of me attempt to override the default-contact-tab. Happy to post the code if it's of use.

Best Answer

Per eyescream's request, I'm posting his answer left in the comments above here:

Wait, so you have both overridden Contacts tab and the Custom tab made out of VF? I don't think you need both. Verify that going to real contacts tab (/003/o) displays your VF page and if it does - delete the custom tab?

I've verified this was the issue, and that that his additional suggestion works too, that being:

If you'll ever need an Admin-like backdoor to the original tab - use link similar to /003/o?nooverride=1 (I keep some of my utility links in home page component that's visible only for SysAdmins).

Worth noting that I tested the above on non-sysadmin user, and the user is able to view the default page if they know the parameters to pass in the URL; which makes sense.

Related Topic