
Many users prefer to have information organized on tabs. Now with Visualforce you can do this in less than 30 seconds (Ok, maybe a minute or two if its your first time)
| Basically we want to go from this: | |
| To this: | |
Before you start, you will need the following:
1. Developer Edition Org with Visualforce enabled. If you don't have a Developer Edition account click here
2. A computer capable of “Cut and Paste”
3. 30 Seconds of spare time (or maybe a little more if it's your first time)
1. Log into your Development account
2. After successful login, edit the path of the URL in the browser to this:
apex/TabbedAccount
3. You will be prompted to create the tabbedAccount page
4. Click on the Link
Your screen should look like this:
1. In the page editor at the bottom, simply delete all the text and replace with this code:
<apex:page standardController="Account" showHeader="true" tabStyle="account" >
<apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
<apex:tab label="Details" name="AccDetails" id="tabdetails">
<apex:detail relatedList="false" title="true"/>
</apex:tab>
<apex:tab label="Contacts" name="Contacts" id="tabContact">
<apex:relatedList subject="{!account}" list="contacts" />
</apex:tab>
<apex:tab label="Opportunities" name="Opportunities" id="tabOpp">
<apex:relatedList subject="{!account}" list="opportunities" />
</apex:tab>
<apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
<apex:relatedList subject="{!account}" list="OpenActivities" />
</apex:tab>
<apex:tab label="Notes and Attachments" name="NotesAndAttachments" id="tabNoteAtt">
<apex:relatedList subject="{!account}" list="NotesAndAttachments" />
</apex:tab>
</apex:tabPanel>
</apex:page>
2. Then click „save“
Congratulations! If your screen looks like the one below, everything is fine… All we need to do now is point the page to an account…
You can point the page to an account by adding the Object ID to the URL:
https://[your URL]?id=0013000000JJiAU
Or...
since we should still have about 10 seconds left, we can override the standard account view with our new Visualforce page.
1. Navigate to Setup -> App Setup -> Customize -> Accounts -> Buttons and Links.
2. Click “Override” next to the View link.
3. Click the “Page” radio button and select “TabbedAccount” from the dropdown list.
4. Click Save
Congratulations, you're done!
The Accounts tab should look like this:
Clicking on the Account Name in any list will now bring you to the Tabbed details page
Many people have asked if its possible to change the color of the tags… Yes of course it is!
<style>
.activeTab {background-color: #236FBD; color:white; background-image:none}
.inactiveTab { background-color: lightgrey; color:black; background-image:none}
</style>
<apex:tabPanel switchType="client" selectedTab=" tabdetails" id="AccountTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab">
<apex:page standardController="Account" showHeader="true" tabStyle="account" >
<style>
.activeTab {background-color: #236FBD; color:white; background-image:none}
.inactiveTab { background-color: lightgrey; color:black; background-image:none}
</style>
<apex:tabPanel switchType="client" selectedTab=" tabdetails" id="AccountTabPanel" tabClass='activeTab' inactiveTabClass='inactiveTab'>
<apex:tab label="Details" name="AccDetails" id="tabdetails">
<apex:detail relatedList="false" title="true"/>
</apex:tab>
<apex:tab label="Contacts" name="Contacts" id="tabContact">
<apex:relatedList subject="{!account}" list="contacts" />
</apex:tab>
<apex:tab label="Opportunities" name="Opportunities" id="tabOpp">
<apex:relatedList subject="{!account}" list="opportunities" />
</apex:tab>
<apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
<apex:relatedList subject="{!account}" list="OpenActivities" />
</apex:tab>
<apex:tab label="Notes and Attachments" name="NotesAndAttachments" id="tabNoteAtt">
<apex:relatedList subject="{!account}" list="NotesAndAttachments" />
</apex:tab>
</apex:tabPanel>
</apex:page>
Your page should now look like this: