An Introduction to Visualforce – SalesForce


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 purpose 1) Connected to controller
2) Can’t connect to the controller 2) Gives ability to connect
3) Pre determined data for view 3) Runtime determines values through the controller
  • Visual force has been released from past 18 months
  • Before VF, we’ve S controls
  • In HTML → <html>
  • In VF →  < prefix.tag>


Ownership :


  • HTML   text  ←  tags
  • VF     data  ←  tags    ↓

Structure :

  • Starting tag is called a root tag in visual force

< Prefix: tag>


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


  • 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,


  • For creating a VF page

→ Sales foprce.com/ apex/page name

  • < apex : page>

</apex : page>

  • < apex : tag/ > is another way of representation
  • Every <apex : page> 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


  • Sales force / apex / page1

→ Create page

→ This is your new page 1


  • 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 <html> as parent tag but we can use after root <html> tags
  • Another way to create VF page

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

  • <apex : page> 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”>

            </apex: page >

  • < ! – – begin default content remove this →  \

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 </h1>

</apex: page block >

<Apex: page block >

</apex: page block >: p


  • < apex: page block section>

</apex: page block section Item >

Congratulations this is your page,

Welcome :

</apex: page block selection item>

< 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 <!h1> {! 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

→  <h1> {1user first name }  <|h1>

Enroll for Instructor Led Live Online Sales Force Training

0 Responses on An Introduction to Visualforce – SalesForce"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.