Blog

Using Visualforce to build a tabbed user interface

In this example we will override a standard view with a few lines of Visualforce to build a tabbed interface.

Use case: Customize the interface for the Account object using Visualforce tabs. The following tabs should be available:

Detail – Display general information about record. Inline edit feature should be supported;
Contacts – Related Contacts list should be displayed in this section;
Opportunities – Related Opportunities list should be displayed in this section;
Activities – Contain two standard related lists – Open Activities and Activity History.

What features do we need to use?

Visualforce Tabs – to separate details and related lists;
Standard Controller – Using the Account standard controller we can override standard actions for the object;

Let’s create a new page. Go to Setup – Develop – Visualforce Pages and hit the New button:

Visualforce page creation

The new Page editor will open:

Visualforce page editor.

Let’s name our page as AccountDetails and replace the existing markup with the following:

[crayon-6114aef40cc23729086366/]

Then click the Save button to save our page. So, it’s a good time to analyze the markup. Let’s see the key points:

<apex:page >

All Visualforce content should be wrapped with this tag. Let’s take a look at it’s attributes:

standardController=”Account” – Determines what object type this page supports. When the page loads the standard controller looks for ‘id’ page parameter and automatically loads the object.

– tabStyle=”Account” Determines that page content has Account object’s look-and-feel.

– title=”{!Account.Name}” Determines the page title. A Formula expression is used to insert the current object’s name for the page title.

<apex:pageMessages />

A block for displaying system messages.

<apex:tabPanel >

A block which contains tabs. Has an attribute:
switchType=”client” – determines that content of all tabs will be loaded on page load. So, no server calls will be performed on switching the tabs. Other available options: “server” (default) – page reloads on tab switch; “ajax” – tab content will be loaded on clicking the tab without page reloading. We are using “client” as it works faster.

<apex:tab >

Used inside the tabPanel tag. Determines a separate tab. Attribute:
label=”Details” – Determines a label for this tab.

Tab panel with tabs.

<apex:pageBlock >

A block which contains tab content. Attributes:
title=”{!Account.Name}” – the same as in the “apex:page” tab.

mode=”inlineEdit” – allows to use inline editing content of the block.

<apex:detail />

Contains details of a record. It takes the standard layout’s content and places it in the detail block. Attributes:

subject=”{!Account}” – Determines object which details should be displayed. The “{!Account}” expression points to standard controller’s record.

relatedList=”false” – Determines that we don’t need to display object’s related list (in the use case we should place all necessary related lists in separate tabs).

inlineEdit=”true” – allows us to modify details without click Edit button.

<apex:relatedList />

This tag used for displaying separate related list we want to place to the tab. Attributes:

subject=”{!Account}” – almost the same as in “apex:detail” tag, determines what object should be used as parent.

list=”Contacts” – links to child relationship. In this case it’s Contacts. Similar ones used for Opportunities and Activities

So, there were key Visualforce features we used to reach our objectives. Now, we need to override standard view with our page. Let’s go to Setup – Customize – Accounts – Buttons, Links, and Actions and click Edit link near the View action:

Account’s Butons, Links and Actions.

Choose a Visualforce Page option and select the page you want to be used instead standard layout. Note that only pages used Account Standard Controller can be selected. Then just save changes:

Override settings

Let’s see the new interface. Go to any Account record.

Detail Tab.

Contacts related list tab.

Opportunities related list tab.

Activities tab
What advantages do we have with this tabbed interface?:
  • The user experience is improved. Easier navigation with tabs, no scrolling needed to find needed a related list;
  • Fully customized UI has been implemented – differentiation by Opportunity status and supporting related records inline editing;
  • We used only the standard controller’s features, we also can use controller extensions to implement any custom functionality

What Certification are you studying for now?

Focus on Force currently provides practice exams and study guides for sixteen certifications

Visualforce Tabbed Interface

Using Visualforce to build a tabbed user interface In this example we will override a standard view with a few lines of Visualforce to build a tabbed interface. Use case: Customize the interface for the Account object using Visualforce tabs. The following tabs should be available: Detail – Display general information about record. Inline edit feature should be supported; Contacts – Related Contacts list should be displayed in this section;… Read More

Visualforce Tabbed Interface

Salesforce Global Picklists

Global Picklists One of the most voted ideas in the Salesforce IdeaExchange forum was to be able to create a picklist that can be shared across objects. Shared Picklist Idea Salesforce delivered the idea in pilot as of Winter ’16, and is now in Beta for Spring ’16. If you look at the release notes, you would find it by the name ‘Global Picklists”. It is also referred to as… Read More

Salesforce Global Picklists

Adding CPQ and Billing Functionality to Salesforce by acquiring SteelBrick

On December 23 2015, just before the holidays, Salesforce and SteelBrick announced an agreement for Salesforce to acquire Steelbrick for $360 million. Salesforce has a long history of acquiring companies that extend and complement Salesforce functionality and this is in the mid range of the scale, with ExactTarget ($2.5 billion in 2013) and Buddy Media ($745 million in 2012) at the high end and comparable with the more recent purchase… Read More

Adding CPQ and Billing Functionality to Salesforce by acquiring SteelBrick

Winter 16 Enhancements for Process Builder

Process Builder was one of the most awaited features released by Salesforce as an upgrade to the possibilties of the Workflow functionality and as part of its effort to strengthen what can be done declaratively. In Winter 16 Salesforce continues to add further enhancements to the Process Builder. Schedule Multiple Actions Prior to the Winter ’16 release, it was only possible to define 1 scheduled action per criteria node or… Read More

Winter 16 Enhancements for Process Builder

Salesforce List Buttons Javascript Example

List buttons can be used on list pages, search results and any related list for an object. They allow us to take actions on a group of selected records. In this article we are going to show some examples of how Javascript can be used to work with one or more records in a list view or related list. These are examples for Salesforce Classic, if you want to know… Read More

Salesforce List Buttons Javascript Example

Routing work with Salesforce Omni Channel

In the Winter 16 release, Salesforce has introduced a new feature – the Omni-Channel, which is based on a principle of getting work to the right person at the right time. It helps put rules in place to allow the system to determine the importance of work items, and pass it on the right person who is available.  Salesforce Omni Channel is built on 4 Functional Blocks: Image Courtesy: Salesforce… Read More

Routing work with Salesforce Omni Channel

Focus on Automation: Visual Workflow Loops

Loops in Visual Workflow Visual Workflow enables many possibilities to automate processes and reduce or eliminate the need for Apex code. One of the key features of Visual Workflow is the ability to process multiple records using a loop construct, unlike standard workflow, where actions such as a field update operate on only one record. Although Process Builder can operate on multiple records to update related records; once the logic… Read More

Focus on Automation: Visual Workflow Loops

Salesforce Manager Group Sharing Example

Manager Group sharing is a little tricky to understand until you see example scenarios. Here we go through a couple of examples to explain how it works. Understanding the Need for Manager Sharing Groups It is a common practice to group users sharing the same business duties under a single Role. For instance, if your organization has 15 territories within a country – and each territory has an Area Sales… Read More

Salesforce Manager Group Sharing Example

Focus on People: Valerio Lancia

I recently had a chat with Valerio Lancia, a Salesforce CRM Application manager about his journey with Salesforce, what he has learned and his recent certification experience. Q: What is your background? Is it an IT background, or a business background, and how did you first get exposed to Salesforce? A: I have a management engineering degree and my initial job in Italy was as a buyer. After two years… Read More

Focus on People: Valerio Lancia

An introduction to Salesforce APIs

Once you start working in the Salesforce world, it won’t take long until you come across the need to integrate or connect your Salesforce org to an internal or external system. At that point, you will start to hear about API’s. While you may think that is something that only developers need to know and understand it is useful for anyone working with Salesforce to know what they are and… Read More

An introduction to Salesforce APIs

Getting Started with Salesforce Entitlements

When a customer calls and requests support, how does a business know if and what level of service they are entitled to? Or what if service is only provided on certain products? Service could be provided for a certain period (e.g. a warranty) and then a customer must pay for service beyond the warranty period. It could also be that customers can purchase extended warranties or service contracts that may… Read More

Getting Started with Salesforce Entitlements

Winter 16 is Coming

Winter is Coming… While you are pondering over deploying the new Summer ’15 features, here is more news. The plan for Salesforce Winter ’16 release is out. It is time to plan your registrations for getting a sandbox preview of Winter ’16 features as and when it becomes available. You would need to take action before September 4, 2015 in case you are planning to make your Sandbox part of… Read More

Winter 16 is Coming

Native Duplicate Management in Salesforce

Administrators (and developers) are often faced with the task of cleaning up duplicate data from an org. Contact and Lead objects are the usual suspects for duplicate data. Anyone who has made an attempt at cleaning up duplicate data would agree it is a daunting and quite unenviable task. Duplicate data weighs down on your employee performance, application usability, risks customer satisfaction, and skews analytics. So, it is a priority… Read More

Native Duplicate Management in Salesforce

Salesforce Multi Org Dilemma

What exactly is a Salesforce org? The Salesforce document glossary describes an org (or Organization), as “A deployment of Salesforce with a defined set of licensed users. An organization is the virtual space provided to an individual customer of Salesforce. Your organization includes all of your data and applications, and is separate from all other organizations.” So, what is a multi-org situation? The multi-org situation that I refer to in… Read More

Salesforce Multi Org Dilemma