Salesforce MVC Architecture | Model View Controller
Salesforce MVC (Model view Controller) separates the complexity of the business logic from the User Interface
and database. Salesforce MVC architecture helps to develop powerful business application. Everything we
develop in Salesforce is part of Model View Controller.
Salesforce MVC architecture with an Example.
It is very important to understand about the flow of the project when working with Sfdc MVC architecture.
Everything we develop in Salesforce is a part of Model View Controller. Developed application in Salesforce
is divided into three kinds of components, SFDC MVC design defines the interaction between them.
Example :- When a custom object is created in Salesforce and a visualforce page is created to display the
details of the record of the custom object using controller. In this Scenario, we observe three parts Object
creation, Visualforce page and Controller.
1. Object Creation is part of “Model”.
2. Visualforce page is part of “View” and
3. Controller is a part of “Controller”.
SFDC Model View Controller (MVC).
So Model View Controller (MVC) is a software architecture pattern which separated the representation of
information from the user’s interaction. So anything displayed to user is a part of view, business
logics/implementation is a part of controller and tables in salesforce is part of Model.
Model : Model or the database is the backbone which forms the bridge between View and Controller. Data is wrapped in
the model and send to the User Interface for display. The metadata, Salesforce objects, Apex Objects and database.com
schema forms the model layer.
View :- Every time we will get a different page view when we click on the page. For every click the page will give us two
page views. Force.com uses Visualforce pages, sites and standard UI buttons, forms, tabs and page views to define a
view.
Controller :- Every event performed on the page will be controlled by controller. Force.com uses workflows, Apex triggers
and Apex Controllers as the controller in the Salesforce MVC architecture.
When we click on the page, Application, Object, Fields, Tabs some action is going to perform. Here buttons,
Tabs are the controllers. It controls and fetch records from the Database and give to the view.
Development in Salesforce can be done in two ways: One is point-and-click with out using single line of code
which is known as declarative programming and the second method is developing application using code,
known as Programmatic development.
Declarative development in Salesforce.
Declarative development in Salesforce is done by point-and-click with out using single line of code using
browser. In this method, Salesforce follows MVC Architecture when developing application.
Model View Controller
Objects Applications W orkflow Rules
Fields Tabs Validation Rules
Relationships Page Layouts Assignment Rule
Records Types
Programmatic development in Salesforce.
In this model of development in Salesforce, Salesforce coding is required. The Salesforce MVC architecture
are as follows.
Model View Controller
W eb Services API Visualforce Pages Apex Controllers
Metadata API Visualforce Components Apex Trigger
External Object Site W eb Service API
Visualforce Tutorials.
⊩ What is Visualforce?
⊩ Difference between Salesforce.com, Force.com and Salesforce1.
⊩ Why should we learn Visualforce?.
⊩ Creating first visualforce page
Visualforce basics
⊩ Building Visualforce page using MVC Model.
⊩ Visualforce Standard Controllers
⊩ Visualforce Custom Controllers
⊩ Visualforce Controller extensions.
⊩ Visualforce standard list controllers.
Visualforce components.
Visualforce components.
⊩ apex:page.
⊩ apex:pagemessage.
⊩ apex:Form
⊩ apex:pageblock.
⊩ apex:Commandbutton.
⊩ apex:pageblockbuttons.
⊩ apex:pageblockSection.
⊩ apex:pageblockSectionItem.
⊩ apex:detail.
⊩ apex:tab.
⊩ apex:tabpanel.
⊩ apex:panelbar
⊩ apex:panelbarItem.
⊩ apex:facetname
Visualforce - Input Components.
⊩ apex:inputText.
⊩ apex:inputSecret.
⊩ apex:inputHidden.
⊩ apex:inputCheckbox
⊩ apex:inputTextArea.
⊩ apex:selectList
⊩ apex:selectoption
⊩ apex:inputField
⊩ apex:selectRadio
⊩ apex:selectCheckBoxes
Enchancing your Organization.
Using Developer Console.
Unit Test