π Getting Started with Visualforce: What, Why, and How?
Welcome to the first post of my Salesforce Visualforce Learning Series, where I document my daily journey of mastering Visualforce and Apex through hands-on projects, real debugging, and practical examples. Whether you're just getting started or refreshing your basics, this blog is written with simplicity and clarity in mind. Let's dive in!
π What is Visualforce?
Visualforce is a component-based UI framework from Salesforce that allows developers to build custom user interfaces using HTML-style tags and optional Apex controllers. It was introduced in 2008 and has been widely used across classic Salesforce applications.
It uses:
Tag-based markup (
<apex:page>,<apex:form>,<apex:outputText>, etc.)Apex controller logic for dynamic behavior and database interaction
π Comparison with LWC and Aura:
| Feature | Visualforce | Aura Components | Lightning Web Components (LWC) |
| Year Introduced | 2008 | 2014 | 2019 |
| Language | Markup (HTML-like) + Apex | JavaScript + HTML | Modern JS + HTML |
| Rendering | Server-side | Client-side | Client-side (modern) |
| Best Use | Legacy, PDF, admin tools | Transition apps | Modern, performant UI |
π Why Learn Visualforce?
Even though Lightning Web Components (LWC) is the modern way to build UI in Salesforce, Visualforce is still essential for:
Maintaining and updating legacy apps
Creating admin-friendly internal tools quickly
PDF generation or complex tabular layouts
Deep integration with standard Salesforce UI and workflows
βοΈ How Does Visualforce Work?
Here are 3 beginner-friendly Visualforce examples:
β 1. Basic Hello World Page
<apex:page>
<h1>Hello Visualforce!</h1>
</apex:page>
β 2. Visualforce Page with Controller
<apex:page controller="MyController">
<h2>Hello {!name}!</h2>
</apex:page>
public class MyController {
public String name { get; set; }
public MyController() {
name = 'Visualforce Developer';
}
}
β 3. Using a Form to Save Data
<apex:page standardController="Contact">
<apex:form>
<apex:inputField value="{!Contact.FirstName}"/>
<apex:inputField value="{!Contact.LastName}"/>
<apex:commandButton action="{!save}" value="Save Contact"/>
</apex:form>
</apex:page>
π‘ My Setup and Plan
I'm learning daily and creating blog posts that:
Are beginner-friendly
Have real examples and working screenshots
Show both the Visualforce Page and Apex Code
Hereβs what Iβll cover next:
π Whatβs Next?
Ready to build your first Visualforce page with a controller?
π Read Part 2: Create Your First Visualforce Page with Apex Controller
In this post, Iβll walk you through:
Creating a Visualforce page from scratch
Writing your first Apex controller
Connecting form data to Salesforce objects
Real example: Create a "Contact Us" form
π§ Beginner-friendly with code + screenshots. No prior Apex knowledge needed!
β¨ Final Thoughts
I believe in learning by doing. If you're trying to understand Visualforce, don't just read β build something! Follow along with my posts to:
Create real apps (like a habit tracker)
Understand how Apex connects to UI
Learn SLDS styling and best practices
Thanks for joining me in this journey. If you liked this post, leave a comment, share your thoughts, or suggest what you'd like to see next!
π Stay tuned for: Create Your First Visualforce Page
Written by [Your Name], a Visualforce learner documenting every step of the journey.