Experience Salesforce

What is Visualforce in Salesforce?

What You’ll Learn

  • What is Visualforce?
  • Sample Of Visualforce Components And Their Corresponding Tags
  • What is a Visualforce Page?

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?

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 that specify what happens when a user interacts with the components specified in the associated Visualforce markup, such as 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 Visualforce controller is a set of instructions that specify what happens when a user interacts with the components specified in the associated Visualforce markup, such as 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. For example, if you use the standard Accounts controller, clicking a Save button on a Visualforce page results in the same behaviour as clicking Save on a standard Account edit page.

If you use a standard controller on a page and the user doesn’t have access to the object, the page will display an insufficient privileges error message. You can avoid this by checking the user’s accessibility for an object and displaying components appropriately.

salesforce-developer
Next Topic

Need Extra Support? Our FREE study materials have got you covered.

Our expert-prepared study materials provide the answers you need. Clear your doubts and improve your skills with detailed notes from industry professionals.

cts-img
Rakshabandhan Sale