Creating visualforce 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 Force.com 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 newbutton. Enter required fields and you can write pages in specified section.  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 
</apex: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. https://c.ap1.visual.force.com/apex/MyFirstVisualforcepage .
Other Way
Now i will explain second way to create visualforce page. Go to url and type /apex/pagename after visual.force.com https://c.ap1.visual.force.com/apex/MyVFpage 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.

Click 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.


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(‘salesforce.com’, ‘force.com’)}</p>
</apex:page>
{!$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(‘salesforce.com’, ‘force.com’)} : 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.


Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget