Learn All About Visualforce in Salesforce
What is Visualforce?
Visualforce is a framework that developers can use to create 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 it very easy to perform basic database operations such as querying and storage.
In the Visualforce markup language, each Visualforce tag corresponds to a coarse-grained or fine-grained user interface component such as a page section, related list, or field. Visualforce component behaviour can be driven by the same logic used in his standard Salesforce pages, or the developer can connect his own logic to his Apex controller.
Sample Visualforce components and corresponding tags.
Don't forget to check out: Share Visualforce Pages Between Classic and Lightning Experience | Salesforce Trailhead
What is a Visualforce Page?
Developers can use Visualforce to create Visualforce page definitions. The page definition consists of two main elements:
- Visualforce markup
- A Visualforce controller
Visualforce Markup
Visualforce markup consists of Visualforce tags, HTML, JavaScript, or other web-enabled code embedded within a single tag. Markup defines which user interface components to include on the page and how to display them.
Visualforce Controllers
A Visualforce controller is a set of statements that specify what happens when the user interacts with the specified component in the associated Visualforce markup, such as B. When a user clicks a button or link. Controllers also provide access to the data displayed on the page and can change the behaviour of components.
Developers can use standard controllers provided by the Lightning Platform or add custom controller logic using classes written in Apex:
- Standard controllers consist of the same functionality and logic used in standard Salesforce pages. For example, if you're using the Standard Account controller, clicking the Save button on a Visualforce page has the same behaviour as clicking Save on a standard Account edit page.
- If the page uses the default controller and the user does not have access to the object, the page will display an insufficient permissions error message. You can avoid this by checking the reachability of the user to the object and rendering the component accordingly.
- A standard list controller lets you create a Visualforce page that can display or edit a set of records. List pages, related lists, and bulk action pages are examples of existing Salesforce pages that work with sets of records.
- A custom controller is a class written in Apex that implements all the logic of a page without using the standard controller. Custom controllers allow you to define new navigation elements or behaviours, but also require you to reimplement functionality already provided by standard controllers.
- Like other Apex classes, custom controllers run entirely in system mode, ignoring the current user's object- and field-level permissions. Based on the user's profile, you can specify whether the user can execute methods in your custom controller.
- A controller extension is a class written in Apex that complements or overrides the behaviour of a standard or custom controller. The extension allows you to leverage the functionality of another controller while adding your own custom logic.
- The standard controller runs in user mode, which enforces the current user's permissions, field-level security, and sharing rules, so you can extend the standard controller to create Visualforce pages that respect user permissions. The extension class runs in system mode, but the default controller runs in user mode. As with custom controllers, you can specify whether a user can execute methods in your controller extension based on the user's profile.
Check out another amazing blog by Nikhil here: Understanding About All the Salesforce Licenses and its Types
Where Can Visualforce Pages Be Used?
Developers can use Visualforce pages to:
- Overrides standard buttons such as the New button for accounts and the Edit button for contacts
- Override the tab overview page. B. The home page of the Account tab.
- Define custom tabs
- Embed components in detail page layouts
- Create dashboard components or custom help pages
- Customize, extend, or embed the Salesforce Console sidebar (Custom Console Components)
- Add navigation menu items and actions in the Mobile app
Reference: usermanual.wiki
Responses