Posts

What are Custom Controllers , Custom List Controller and Controller Extensions?

A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user. Example <apex:page controller="myController" tabStyle="Account">     <apex:form>         <apex:pageBlock title="Congratulations {!$User.FirstName}">             You belong to Account Name: <apex:inputField value="{!account.name}"/>             <apex:commandButton action="{!save}" value="save"/>         </apex:pageBlock>     </apex:form> </apex:page> public class MyController {     private final Account account;     public MyController() {         account = [SELECT Id, Name, Site FROM Acco...

Floating Menu on Visualforce Page

Image
Here's an example to create a floating menu. <apex:page > <html> <body> <style> div.floating-menu {position:fixed;background:#fff4c8;border:1px solid #ffcc00;width:150px;z-index:100;} div.floating-menu a, div.floating-menu h3 {display:block;margin:0 0.5em;} </style> <div class="floating-menu"> <h3>Floating Menu</h3> <a href="http://www.quackit.com/css/">CSS</a> <a href="http://www.quackit.com/html/">HTML</a> <a href="http://www.quackit.com/javascript/">JavaScript</a> <a href="http://www.quackit.com/coldfusion/">ColdFusion</a> <a href="http://www.quackit.com/myspace/codes/">MySpace Codes</a> </div> </body> </html> </apex:page> 

What Is Standard Controller In Visualforce?

In Visualforce, a standard controller is a pre-built Apex controller provided by Salesforce that allows developers to work with standard database objects (such as records from Salesforce objects like Account, Contact, Opportunity, etc.) without having to write custom Apex code. Standard controllers provide basic CRUD (Create, Read, Update, Delete) operations and other standard functionality for interacting with these objects in Visualforce pages. When using a standard controller in Visualforce, you can directly reference fields and perform operations like saving records without explicitly writing Apex code. Standard controllers also handle security and access permissions automatically, ensuring that users only have access to the records they are authorized to view or modify. Here's a basic example of using a standard controller in Visualforce: <apex:page standardController="Account">     <apex:form>         <apex:inputField value="{!Account.N...

What Is Standard List Controllers In Visualforce?

Standard List Controllers in Visualforce provide developers with a way to display lists of records from standard or custom Salesforce objects without the need for writing Apex code explicitly. These controllers come pre-built with basic functionality for navigating, filtering, and working with collections of records. Here are some key points about Standard List Controllers: Built-in CRUD Operations: Standard List Controllers provide basic CRUD operations (Create, Read, Update, Delete) out-of-the-box, allowing users to view, edit, and delete records directly from Visualforce pages without writing custom Apex code. Automatic Pagination: When displaying a large set of records, Standard List Controllers automatically handle pagination, splitting the records into manageable chunks and providing navigation controls for users to navigate between pages. Sorting and Filtering: Standard List Controllers offer built-in support for sorting and filtering records based on various criteria, such as f...

Where Can Visualforce Pages Be Used?

Developers can use Visualforce pages to: Override standard buttons, such as the New button for accounts, or the Edit button for contacts Override tab overview pages, such as the Accounts tab home page 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

What is Visualforce Controllers ?

A Visualforce controller is a set of instructions for what happens when a user interacts with components specified in associated Visualforce markup. One type of interaction is when a user clicks a button or link. Controllers also provide access to the data displayed in a page, and can modify component behavior. A developer can either use a standard controller provided by 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 in a Visualforce page results in the same behavior 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 displays an insufficient privileges error message. Resolve this error by checking the user's accessibility for an object and displaying compo...

How is Visualforce Architected?

Image
All Visualforce pages run entirely on the Lightning platform, both when a developer creates the page, and when an end user requests a page, as shown in the following architecture diagrams. Visualforce System Architecture - Development Mode   When a developer finishes writing a Visualforce page and saves it to the platform, the platform application server attempts to compile the markup into an abstract set of instructions that can be understood by the Visualforce renderer. If compilation generates errors, the save is aborted and the errors are returned to the developer. Otherwise, the instructions are saved to the metadata repository and sent to the Visualforce renderer. The renderer turns the instructions into HTML and then refreshes the developer's view, thereby providing instantaneous feedback to the developer for whatever changes were made in the markup. The architecture diagram below shows the process flow when a non-developer user requests a Visualforce page. Because the page ...