Introduction to Salesforce Standard Controller

Visualforce is a collection of commands that mention what takes place when a user communicates with the components mentioned in related visualforce markup. Controllers also facilitate access to data that is to be exhibited in a page and can change the behaviour of the component. The Lightning platform enables a lot of standard controllers that comprise the same service logic that is employed for standard salesforce pages. Standard list controllers can be used with the following objects.

  • Asset
  • Case
  • Contract
  • Contact

Want to enhance your skills in dealing with the worlds best CRM, enroll in our Salesforce Training 

  • Product2
  • User
  • Solution
  • Idea
  • Lead
  • campaign

 Visualforce uses Model-view-controller techniques to use the data; they are as follows:

1. Model

It comprises application data, and it does not contain the logic required for presenting the data.

2. View

It comprises the data of the model. View understands how to use the data of the model.

3. Controller

The Controller is present between the model and the view. It withholds the events that are invoked by the view and implements a suitable response to these events. 

Checkout SalesForce Tutorial

How to use Standard Controllers in Salesforce

Subscribe to our youtube channel to get new updates..!

In Visualforce pages, we use a standard controller by using the “StandardController” attribute in the tag. We will not be able to use the controller attribute while implementing the “standard controller” method in the visual force pages. 

Steps to create a visualforce page that implements and perceives the utility of the Standard controllers:

  • Go to Salesforce.com and log into your account by entering username and password.
  • Go to the URL, and include apex/visualforce page name as displayed below:
  • If there is no visualforce page with that name, then “visualforce error” occurs.
  • We can create that visualforce page through the “Create Visualforce page” link.

Example for Visualforce page

Accessing data with a Standard controller

Each standard Controller comprises a getter method that gives the record mentioned by the “name” query string argument in the page URL. This method enables the related page markup to mention the fields of the situation on the connection record through syntax(!object) syntax, where the object related to the Controller is written in lowercase.

For example. If a page is using an Account standard controller then it uses(!account.name) to determine the value of the name field. 

Standard Controller Actions

The standard controller Actions are as follows:

Save: This action inserts a new record and updates a record if it is available. When this action is completed, the save action comes back to the starting page.

Quicksave: This action inserts a new record and updates an available record, and the “quicksave” does not divert users to the initial page. 

Edit: Through this action, users can edit the page for the record that is available. When this task is completed, the edit action returns the user to the page.

List: It gives a Page reference object of the normal List page.

Styling Pages Through standard Controller

The page related to a standard controller systematically acquires the style which is used for regular salesforce pages related to the mentioned object. Pick the object that looks to be chosen. You can overrule the page styling that uses the standard Controller through the “tab style” property of the tag. For example :

<apex:page StandardController=” Mindmajix” tabstyle=”Python training”>

</apex:page>

Checkout Salesforce Interview Questions

Validation Rules and Standard Controllers

If a user types data on a visualforce page that access a standard controller and that data induces a validation rule fault, the fault can be exhibited on the visualforce page. If the error location of the validation rule is at the top of the page, then we will utilise the or method under the to exhibit the error.  

Monitoring the Accessibility of the object

If a person has not enough permissions to see the object, the visual force page that employs a controller to make that object unapproachable, to evade this fault, you should assure that your components will only deliver if a user has entry to the object related to the Controller. 

Through the statement, you can monitor the availability of an object like this:

{!object_Type. Object_name. available}

Conclusion

Visualforce uses standard controllers to control the data of the visual force page. Controllers communicate with the database and fetch the data from the database. By using the recordID, it will display a particular record and a bunch of records. In an Independent page, we are required to mention the ID of the record.

In the next topic, we will discuss in detail about “custom Controller In Salesforce”. Keep following us for more info on Salesforce Development/Programming.

Are you looking to get trained on Salesforce, we have the right course designed according to your needs. Our expert trainers help you gain the essential knowledge required for the latest industry needs. Join our Salesforce Certification Training program from your nearest city.

Salesforce Training Chennai, Salesforce Training Dallas, Salesforce Training Bangalore, Salesforce Training Hyderabad, Salesforce Training Mumbai, Salesforce Training Delhi, Salesforce Training Noida, Salesforce Training New York, Salesforce Training Chicago, Salesforce Training Kolkata, Salesforce Training Gurgaon, Salesforce Training Pune.

These courses are equipped with Live Instructor-Led Training, Industry Use cases, and hands-on live projects. Additionally, you get access to Free Mock Interviews, Job and Certification Assistance by Certified Salesforce Trainers.

Explore Salesforce Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Mindmajix offers different Salesforce certification training according to your desire with hands-on experience on Salesforce concepts