Learn from industry experts! Admin batch starts from 19 Feb.
Hurry up!
Book your slot now!

15

What is Visualforce in Salesforce?

Visualforce in Salesforce

Visualforce in Salesforce stands as one of the most powerful tools for building custom User Interfaces. From tailored pages for desktop to mobile applications, Visualforce makes it more flexible for the developers to go beyond the standard layouts. It uses a combination of HTML, Apex, and JavaScript that developers can utilize to build customized pages. It also integrates with Salesforce Data seamlessly. In this chapter we will look at what is Visualforce in detail and understand its importance.

What is Visualforce?

Visualforce is a framework that allows developers to build sophisticated, custom user interfaces that can be hosted natively on the Lightning platform. The Visualforce framework includes a tag-based markup language, similar to HTML, and a set of server-side “standard controllers” that make basic database operations, such as queries and saves, very simple to perform.

In the Visualforce markup language, each Visualforce tag corresponds to a coarse or fine-grained user interface component, such as a section of a page, a related list, or a field. The behaviour of Visualforce components can either be controlled by the same logic that is used in standard Salesforce pages, or developers can associate their own logic with a controller class written in Apex.

Sample Of Visualforce Components And Their Corresponding Tags

An Apex page with callouts to the apex: page, apex:commandLink, apex: image, apex: related list, apex:pageBlock, apex:dataTable, and apex: detail tags.

What is a Visualforce Page?

Visualforce pages in Salesforce are the top level container for custom apps built with Visualforce. You can create Visualforce pages by adding Visualforce components (standard or custom), static HTML markup, and CSS styles and JavaScript to the page. Developers can use Visualforce to create a Visualforce page definition. A page definition consists of two primary elements:

1. Visualforce markup

2. A Visualforce controller

Visualforce Markup

Visualforce markup consists of Visualforce tags, HTML, JavaScript, or any other Web-enabled code embedded within a single <apex: page> tag. The markup defines the user interface components that should be included on the page, and the way they should appear.

Visualforce Controller

A Visualforce controller is a set of instructions in Visualforce that specify what happens when a user interacts with the components specified in the associated Visualforce markup. For example when a user clicks a button or link. Controllers also provide access to the data that should be displayed on a page and can modify component behaviour.

A developer can either use a standard controller provided by the Lightning platform or add custom controller logic with a class written in Apex:

  • A standard controller consists of the same functionality and logic that is used for a standard Salesforce page. 
  • A standard list controller enables you to create Visualforce pages that can display or act on a set of records.
  • A custom controller is a class written in Apex that implements all of a page’s logic, without leveraging a standard controller.
salesforce-developer

Where Can Visualforce Pages Be Used?

Developers can use Visualforce pages to a lot of things. Some of these are mentioned below:

  • You can override standard buttons, such as the New button for accounts, or the Edit button for contacts.
  • You can override tab overview pages, such as the Accounts tab home page.
  • Easily define custom tabs.
  • Embed components in detail page layouts.
  • Create dashboard components or custom help pages.
  • Customize, extend, or integrate the sidebars in the Salesforce console (custom console components).
  • Add navigation menu items and actions in the Salesforce mobile app.
Next Topic

Need more support?

Get a head start with our FREE study notes!

Learn more and get all the answers you need at zero cost. Improve your skills using our detailed notes prepared by industry experts to help you excel.

Book A 15-Minutes Free Career Counselling Today!