Salesforce Standard Controllers - Salesforce

What is Salesforce Standard Controllers?

Visualforce comprises of many built-in controllers which can be used to entree and show data. It works on the MVC (model-view-controller) method. The controllers relate with the database and pull the data from the database to view the data over a webpage formed by apex page.
To show a precise record or group of records, we want the record ID. When integrated with other Visualforce pages the ID can flow to the controller page automatically. But in a standalone page we want to specify the record ID manually to see the controller working.


Let us produce a Visualforce page to get the summary of a record in the Contact object. To do this, we use the component called standardController and put it in an apex block. The diagram given below displays the code to achieve this.


Here we show some choice fields from the Object. They are Name, Email and phone. If we go to the Preview window, we find that the page only shows the labels but no data. That is since we have not related the result from the controller with any precise record.

So next we classify a record form the Contact Object to be committed to the result from the controller. Open the contacts object and click on any of contact name. It will open the resulting window from which we capture the ID of the record. The ID is highlighted in the URL. In your environment, it will be a alike string of characters.


Lastly, we add this ID of the record to the URL of the preview window of the Visualforce standard controller page we created. In the present instance, the ID of the record is added as shown below.

On visiting the above URL from the Organization's salesforce account, we get the particulars of the record as revealed below.


All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Salesforce Topics