Introducing a Visualforce page

In Salesforce, it is very easy to build powerful applications using only declarative methods; however, there are some situations where declarative methods aren't enough if you want to build an application. In Salesforce, standard and custom objects have their own standard user interface, either classic or Lightning Experience. You can easily customize a standard user interface by creating multiple page layouts using "clicks not code." A standard user interface has its own limitations; for example, you can't create three column pages or generate a PDF out of it. This is where the Visualforce markup language comes into play.

Similar to HTML, Visualforce is a markup-based user interface design language. Visualforce is a framework that includes a tag-based markup language that allows you to build sophisticated, attractive, and dynamic custom user interfaces. You can use almost all the standard web technologies, for example, CSS, jQuery, HTML5, and so on, along with a Visualforce page. This means you can build rich user interfaces for any device, including mobile or tablet.

The best way to view, create, and modify a Visualforce page is via the Setup page; just navigate to Setup (gear icon) | Setup | PLATFORM TOOLS | Custom Code | Visualforce Pages. It will look like the following screenshot:

Introducing a Visualforce page

Another way to create a Visualforce page is by entering the page names in your browser's address bar. To use this, make sure that Development Mode is enabled in the particular user record. You will be redirected to a blank Visualforce page and you can specify the name of the page there.

Understanding the MVC model

Visualforce pages are rendered on the Salesforce server, and they display the output on a client machine, typically a web browser. As such, Visualforce has server-side access to data and logic. Modern platforms will separate the model, view, and database into distinct layers. This gives you modularity and containment for making your application easier to code and maintain. The following figure highlights the various layers of the MVC pattern:

Understanding the MVC model

  • Model: This defines the structure of the data. In Salesforce, objects define the data model. In other words, it can be defined as either sObjects or classes in Apex.
  • View: This defines how data is represented. In Salesforce, page layouts and Visualforce pages fall under this category.
  • Controller: This defines business logic. The rules and actions which manipulate the data controls the view. In Salesforce, Apex classes, Apex triggers, Process Builders, and approval processes fall under this category.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.21.229