Get Started with Visualforce
Learning Objectives
Introduction to Visualforce
Visualforce enables developers to extend Salesforce’s built-in features, replace them with new functionality, and build completely new apps. Use powerful built-in standard controller features, or write your own custom business logic in Apex. You can build functionality for your own organization, or create apps for sale in the AppExchange.

An Example Visualforce Page
<apex:page standardController="Contact" > <apex:form > <apex:pageBlock title="Edit Contact"> <apex:pageBlockSection columns="1"> <apex:inputField value="{!Contact.FirstName}"/> <apex:inputField value="{!Contact.LastName}"/> <apex:inputField value="{!Contact.Email}"/> <apex:inputField value="{!Contact.Birthdate}"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:form> </apex:page>

- It connects to the Visualforce standard controller, a part of the Visualforce framework that provides automatic data access and modification, standard actions, and more.
- When accessed without a record ID, the page displays a blank data entry form. When you click Save, a new record is created from the form data.
- When accessed with a record ID, the page looks up the data for that contact record and displays it in an editable form. When you click Save, your changes for the contact are saved back to the database.
- Each input field is smart about how it presents its value.
- The email field knows what a valid email address looks like, and displays an error if an invalid email is entered.
- The date field displays a date widget when you click into the field to make entering a date easier.
- The Save button calls the save action method, one of the standard actions provided by the standard controller.
Where You Can Use Visualforce
The following are some of the ways you can add Visualforce to your organization. Remember that these screenshots are showing examples and don't reflect the custom pages and apps in your org.
Open a Visualforce Page from the App Launcher


Click a custom app (1) to activate it. Items in the app display in the navigation bar, including any Visualforce tabs you’ve added to the app. Note that you need to add your Visualforce pages to tabs for them to be accessible in the App Launcher. Visualforce tabs that aren’t in apps can be found in All Items (2).
Add a Visualforce Page to the Navigation Bar

Display a Visualforce Page within a Standard Page Layout

Add a Visualforce Page as a Component in the Lightning App Builder

Launch a Visualforce Page as a Quick Action


Display a Visualforce Page by Overriding Standard Buttons or Links

Display a Visualforce Page Using Custom Buttons or Links
You can create new actions for your objects, in the form of buttons and links, by defining them on an object. JavaScript buttons and links aren’t supported in Lightning Experience, but Visualforce (and URL) items are. The process of defining Visualforce buttons and links is identical to that in Salesforce Classic, so we won’t bother to show it here.