An Introduction to Visualforce – SalesForce

Visualforce is the Force.com platform's component-based user interface framework. This article introduces Visualforce. It explains how to work with Visualforce by illustrating the primary areas of functionality, providing an overview of tags, and demonstrating how to use them

Visualforce

Visualforce is the component-based user interface framework for the Force.com platform. Visualforce boasts about 100 built-in components, and a mechanism whereby developers can create their own components.

  • It is a very interesting framework in Salesforce.
  • It is a markup language used to determine the required view for a user
  • Every markup language is denoted through certain tags
  • The web page is nothing but ‘online content’
  • URL: – It is the address of a web page.
  • The online content from the form goes to controller (apex)
  • The VF gives the dynamic content to the apex (control )
  • VF is used to create dynamic content    
          
Static tag  Dynamic tag
1) Current page’s purpose1) Connected to controller
2) Can’t connect to the controller 2) Gives ability to connect
3) Pre determined data for view3) Runtime determines values through the controller

 

Interested in mastering Salesforce? Enroll now for FREE Demo on Salesforce training
  • Visual force has been released from past 18 months
  • Before VF, we’ve S controls
  • In HTML →
  • In VF →  < prefix.tag>

                   ↓

Ownership :
Ownership

  • HTML   text  ←  tags
  • VF     data  ←  tags    ↓

Structure :

  • Starting tag is called a root tag in visual force

< Prefix: tag>

XSD

  • XSD: – it supports up to 40 different types of values

Structure

MindMajix Youtube Channel

  • Visual force is derived from XSD
  • The View is for display → retrieve from the DB
    Accept → input to the DB
  • For creating VF pages we’ve to enable the development mode, for this,
Explore Salesforce Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Structure Set up

  • For creating a VF page
    → Sales foprce.com/ apex/page name
  • < apex : page>
  • < apex : tag/ > is another way of representation
  • Every will have attributes
  • < apex : page>
  • < apex : page name ↓ = “hello” ↓

Attribute value :

  • One tag can have any No.of attributes
  • In VF all types are classified into two types

Attribute value

as parent tag but we can use after roottags

  • Sales force / apex / page1
    → Create page
    → This is your new page 1
    Attribute value_
  • If your data is visible to the browser you’ve must use (or) add all html tags
  • Data display in the browser uses HTML tags
  • We can’t use
  • Another way to create VF page

–> Setup → app setup → develop → pages → new

  • side bar = false / true

< /apex: page >

  • False sidebar will remove
  • A true side bar will appear
  • < apex : page side bar = “false” tab style = “students – – c”>

< /apex: page>
→ Singular label student → sales force (view)
→ Plural label students → tab
→ Object name, student → DB
→ API Name student _ _ c → force.com

  • VF reports to apex, so we’ve to use only API names i.e. (student – – c)
  • ?< apex : page side bar = “false” tab style = “student – – c”
    Show header = “false”> 
  • < ! – – begin default content remove this →  

Frequently Asked Salesforce Interview Questions & Answers

Comment in VF :

For understanding the code to know what task you write,

  • Comments are used by good programmers
  • If there are more no. of lines for a code, it is recommended to comment for crucial thing
  • Attributes
    • Sidebar             }
    • Show header     }   display purpose
    • Tab style           }
  • < apex : page block >
    < /apex: page block >  ↓

It creates a block in a page

  • We can create any no. of page blocks in a page
  • < apex : page >

< Apex: page block >
< h1> congratulations Ashok


: p

  • < apex: page block section>

Congratulations this is your page,
Welcome :

< Apex: page block selection Item>
Thank you .

  • To add dynamic content to VF we use {!}
  • {!} represent an expression that gives gets evaluated at runtime

→ {!v40  20}
→ < h1> congrats {! 40 20}

  • VF has gotten a lot of global variables
  • Whichever is valid for pages throughout VF

Global: This means the method or variable can be used by any Apex code that has access to the class, not just the Apex code in the same application. This access modifier should be used for any method that needs to be referenced outside of the application, either in the SOAP API or by other Apex code. If you declare a method or variable as global, you must also declare the class that contains it as global.
It is a value that can be accessed across all the VF pages

Global variables: 
Use global variables to reference general information about the current user and your organization on a page. Global variables must be referenced using Visualforce expression syntax to be evaluated, for example, {!$User.FirstName}.
It is a variable value that can be accessed across all the VF pages
→ All global variables are represented by $
Eg: & user
→  
{1user first name }  <|h1>

                       Check Out Salesforce Tutorials

Mindmajix offers different Salesforce certification training according to your desire with hands-on experience on Salesforce concepts

Salesforce Administration TrainingSalesforce Lightning Training
Salesforce Advanced Developer TrainingSalesforce Developer Training
Salesforce IoT TrainingSalesforce App Builder Certification Training
Salesforce AppExchange TrainingSalesforce Service Cloud Training
and many more.. 

 

Course Schedule
NameDates
Salesforce TrainingOct 15 to Oct 30View Details
Salesforce TrainingOct 19 to Nov 03View Details
Salesforce TrainingOct 22 to Nov 06View Details
Salesforce TrainingOct 26 to Nov 10View Details
Last updated: 04 Apr 2023
About Author

Arogyalokesh is a Technical Content Writer and manages content creation on various IT platforms at Mindmajix. He is dedicated to creating useful and engaging content on Salesforce, Blockchain, Docker, SQL Server, Tangle, Jira, and few other technologies. Get in touch with him on LinkedIn and Twitter.

read less
  1. Share:
Salesforce Articles