Visualforce – Creating simple page

Creating visualforce pages in salesforce:

visualforce is very interesting framework in salesforce. It is a markup language you can use this to develop user interface according to your requirements in salesforce. visualforce runs on platform.  To design UI you can write visualforce pages and by using controllers you can write business logic to your visaulforce pages. In visualforce pages to write business logic we have there types of controllers. – A standard controller – A custom controller – A controller extension We will discuss about these controllers later. Here I will give you very simple example to create visualforce page. Will provide more information in later posts. To create VF page go to setup -> Build -> develop -> Pages and click on new button. Enter required fields and you can write pages in specified section. Visualforce Page   In the above image you can write your page in red colored marked space.

<apex:page >
<h1>Welcome to Salesforce</h1><br/>
This is your new Page

Above snippet is simple VF page. Here will explain about about this. Every Page should start and end with  <apex:page> </apex:page> To see the output for above go to url and type /apex/pagename. .

Other Way

Now i will explain second way to create visualforce page. Go to url and type /apex/pagename after and click on enter.

If the page already available you will see output, If that page is not available, it will ask to create that page. See the below image for reference. visualforceClick on link. The page will create and you can create that page and after saving you see output. See the  the below image for reference. visualforce Vf 3 See the above image for reference. This option is available only when you enable developer mode at user level.

Below is the simple example, how to use simple simple formulas, functions in vf page.

<apex:page sidebar=”false” showHeader=”false”>
          <h1>Hello “{!$User.LastName}” Welcome to Salesforce</h1>
          <p> Today’s Date is {! TODAY()} </p>
          <p> Next week it will be {! TODAY() + 7} </p>
          <p>The year today is {! YEAR(TODAY())}</p>
          <p>Tomorrow will be day number {! DAY(TODAY() + 1)}</p>
          <p>Let’s find a maximum: {! MAX(1,2,3,4,5,6,5,4,3,2,1)} </p>
          <p>The square root of 49 is {! SQRT(49)}</p>
          <p>Is it true? {! CONTAINS(‘’, ‘’)}</p>

{!$User.LastName} is simple formula. By using this formula we can get the user name. User is the standard object which stores user information in your salesforce org.

{! TODAY()} : It will display today date.

{! TODAY() + 7} : It will display date after 7 days.

{! YEAR(TODAY())} : It will display year of the today

{! DAY(TODAY() + 1)}: It will display day of the today

{! MAX(1,2,3,4,5,6,5,4,3,2,1)}: It will display maximum number.

{! SQRT(49)} : It will display square root of given number.

{! CONTAINS(‘’, ‘’)} : It will display Boolean value based on the given condition

Hope you understand how to create simple vf page. Later we will discuss about more concepts in visualforce pages.

6 thoughts on “Visualforce – Creating simple page”

    1. we will write it in sales force platform .so you can make account as a developer also follow the instruction it is so easy .about VF pages go setup + build +develop+page and write the code that is it

    2. Hi Bhuvana, Visualforce is a mark up language like HTML and it runs on platform. No need to install any s/w to write visualforce pages. You need a salesforce account with required permissions to write visualforce pages.

Leave a Reply