How to create Visualforce page in Salesforce?

Visualforce page in Salesforce can be created using developer console, using Visualforce pages and using URL. Visualforce in Salesforce has powerful development tools like syntax highlighting, tag pair matching, auto suggest, smart indenting and auto complete. Before creating visualforce pages in Salesforce, Development mode in Salesforce must be enabled, so that we can create Visualforce pages in the user interface directly.

To enable development mode navigate to Name | My Settings | Personal | Advanced user details | Edit.

Enabling development mode in Salesforce

Creating first Visualforce page in Salesforce.

In Salesforce, Visualforce pages can be created in different ways. Some of them are

  1. Visualforce pages.
  2. Developer Console and
  3. URL.

Creating Salesforce Visualforce pages in Developer Console.

To create new vf page in developer console follow the steps given below.

  1. Open Developer console under your name or quick access menu.Salesforce Developer Console
  2. Now developer Console will be opened in New window.
  3. To create VF page click File | New | Visualforce page.
How to create Visualforce Page in Salesforce from developer console
</>
Copy
<apex:page> 
    <h1>Hello World</h1> 
</apex:page>
  • Now to File | Click on save button.
  • Now click on preview button to see you new Vf page.

Creating Visualforce pages from the Setup.

  • To create vf pages in Salesforce navigate to Setup | Build | Develop | Visualforce pages.
Visualforce page from develop
  • Click on New button to create vf page.
  • Enter label and Name.
  • Finally click on save button.

Creating Visualforce pages using URL.

When development mode is enabled in salesforce, we can create Visualforce page simply by URL. To create Visualforce page in SFDC, we need not go Setup | Build | Develop | pages or Developer console every time. Here is another way to create Visualforce page directly from URL. This is the shortcut to create visualforce page in Salesforce.  https://c.ap4.visual.force.com/apex/PageName (Visualforce page name).

How to create Visualforce Page in Salesforce from URL

Click on createpage Vftestpage to create new Vf page in Salesforce.

Creating visualforce page

To check the created visualforce page navigate to Build | Develop | Visualforce. Here list of all Vf pages in Salesforce will be displayed.

Visualforce pages

Visualforce pages can be used in different ways in Salesforce organization. Some of them are

  • VF pages can be used by overriding the standard button.
  • VF page can be called using the custom help links for the custom object.
  • Creating JavaScript button to open VF page.
  • Creating custom buttons to open VF page.
  • Vf pages can be added to custom tabs, dashboards and page layouts.