You are here:
Create Visualforce Pages
You can create Visualforce pages either by using Visualforce development mode, or by creating pages in Setup.
Required Editions
| Available in: Salesforce Classic and Lightning Experience |
| Available in: Contact Manager, Group, Professional, Enterprise, Performance, Unlimited, and Developer Editions |
| User Permissions Needed | |
|---|---|
| To create, edit, and set version settings for Visualforce pages: | Customize Application |
To create a page using the “quick fix” tool available in Visualforce development mode:
-
In your browser, enter a URL in the following form:
https://yourSalesforceOrgURL/apex/nameOfNewPage,
where the value of yourSalesforceOrgURL is the URL used to access your
Salesforce org (for example,
MyDomainName.my.salesforce.com) and the value of
nameOfNewPage is the value you want to give to the
Name field on your page definition.
For example, if you want to create a page called “HelloWorld” and your Salesforce organization uses the URL MyDomainName.my.salesforce.com, enter https://MyDomainName.my.salesforce.com/apex/HelloWorld.
Note Page names can’t be longer than 40 characters. - Because the page does not yet exist, you are directed to an intermediary page from which you can create your new page. Click Create page nameOfNewPage to create the new page. Both the page Name and Label are assigned the nameOfNewPage value you specified in the URL.
To Create Pages in Setup:
- From Setup, enter Visualforce Pages in the Quick Find box, then select Visualforce Pages.
- Click New.
- In the Name text box, enter the text that should appear in the URL as the page name. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
- In the Label text box, enter the text that should be used to identify the page in Setup tools, such as when defining custom tabs, or overriding standard buttons.
- In the Name text box, enter the text that should be used to identify the page in the API. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores.
- In the Description text box, specify an optional description of the page.
-
Select Available for Salesforce mobile apps to enable
Visualforce tabs associated with the Visualforce page to be displayed in the Salesforce
mobile app. This checkbox is available for pages set to API version 27.0 and
later.
NoteStandard object tabs that are overridden with a Visualforce page aren’t supported in the Salesforce mobile app, even if you select the Available for Salesforce mobile apps option for the page. The default Salesforce app page for the object is displayed instead of the Visualforce page.
- Select Require CSRF protection on GET requests to enable Cross Site Request Forgery (CSRF) protection for GET requests for the page. When checked, it protects against CSRF attacks by modifying the page to require a CSRF confirmation token, a random string of characters in the URL parameters. With every GET request, Visualforce checks the validity of this string of characters and doesn’t load the page unless the value found matches the value expected.
- Check this box if the page performs any DML operation when it’s initially loaded. When checked, all links to this page need a CSRF token added to the URL query string parameters. This checkbox is available for pages set to API version 28.0 and later.
- In the Visualforce Markup text box, enter Visualforce markup for the page. A single page can hold up to 1 MB of text, or approximately 1,000,000 characters.
- Click Version Settings to specify the version of Visualforce and the API used with this page. You can also specify versions for any managed packages installed in your organization.
-
Click Save to save your changes and return to the Visualforce
detail screen, or click Quick Save to save your changes and
continue editing your page. Your Visualforce markup must be valid before you can save
your page.
Note Though your Visualforce markup can be edited from this part of Setup, to see the results of your edits you have to navigate to the URL of your page. For that reason, most developers prefer to work with development mode enabled so they can view and edit pages in a single window.
Once your page has been created, you can access it by clicking Preview. You can also view it manually by entering a URL in the following form: http://yourSalesforceOrgURL/apex/nameOfNewPage, where the value of yourSalesforceOrgURL is your Salesforce organization’s URL (for example, MyDomainName.my.salesforce.com) and the value of nameOfNewPage is the value of the Name field on your page definition.

