Controllers in Salesforce
Using S.Control's for UI (User Interface)
The tool that allows application developers to display custom links (HTML) in a detail page or custom tab, this provides more flexibility for the fields and page layouts. But
- Executes from within a browser, causing poor performance if displaying or updating values for more than a few records at a time.
- Do not provide an easy way to give custom UI elements the same look-and-feel as standard SF pages.
- Require developer to enforce field uniqueness and other metadata dependencies on their own.
Note: S.control's are suppressed by VF pages (Visual Force).After March 2010 organizations that have never created S.Control's as well as new organizations, won't be allowed to create them
Existing S.Control's will remain and can still be edited.
These are the reasons why VF pages came in to existence; these are next generation solutions for building sophisticated user interfaces on the Force.com platform.
What is Visulal Force?
VF is a frame work that allows developers to build sophisticated, custom user interfaces that can be hosted natively on the Force.com platform. This includes a tag based markup language, similar to HTML.
In VF markup language each VF tag corresponds to a coarse or fine-gained users interface components such as
- Section of page
- A related list or a field
The behavior of VF components can be controlled by the same logic that is used in standard SF pages, or developer can associated their own logic with a controller class written in APEX.
Inclined to build a profession as Salesforce APEX Developer? Then here is the blog post on
Tag in VF are <apex:page>
<apex:page Block Buttons>
<apex: page Block section>
` <apex:page Block section Item>
<apex:page Block Table> ------> Tags related to a page tags
Input field tags:
<apex:input text >
<apex:input text area>
Output field Tags:
Like this there are around 90 tags in VF and each tag full fills request such as defining a page, page block field, toolbar these tags can be divided into
- Input tags
- Output tags
- Select tags
- Form tags
- Page tags and so on…
Using these tags developers can create a VF page definition. It consists of two
VF Markup ---> AVF ---> Controller
VF controller is a set of instructions that specifies what happens when a user interacts with UI components specified by VF markup, (such as when user clicks on the button on link).controller also provides access to the data that should be displayed on the page, and can modify component behavior.
A developer can use a standard controller consists of the same functionality and logic that is used for a standard salesforce page.
Note: If we use the standard Account controller, clicking a save button in VF page results in same behavior as clicking save button on Account edit page Using page layouts, we cannot have access to the objects in standard field, and display's an error called as insufficient privileges error message, we can avoid this by checking the user's accessibility for an object and displaying component approximately.
- A standard list controller enables us to create VF pages that can display an act on a set of records like list pages, related lists, and mass action pages.
- Custom controller: it’s a class written in Apex that implements all page's logic, without leveraging a standard controller, if we define this, we have to define new navigation elements or behaviors, but we must implement any functionality that was already provided in a standard controller.
- Controller extension: class written in Apex that adds to or overrides behavior in a standard or custom controller.
Extensions allow us to leverage the functionality of another controller while adding your own logic.
Visual Pages Force can be used:
Developer can use VF pages to
- Override standard buttons, such as NEW button for accounts, save button for contacts.....
- Define custom tab.
- Embed components in detail page layout.
- Create dashboard components on custom help pages.
- Customize, extend on integrate the sideboards in the services cloud console (custom console components)