Home  >  Blog  >   Salesforce  > 

Standard Controller In Salesforce

Rating: 5
  
 
4736
  1. Share:
Salesforce Articles

 

If you want to enrich your career by advancing in Salesforce, then sign in" Salesforce Course  " and expert!

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 on a page and can change the behavior 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
  • Product
  • 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. 

MindMajix YouTube Channel

Checkout Salesforce Tutorial

How to use Standard Controllers in Salesforce

In Visualforce pages, we use a standard controller by using the “StandardController” attribute in the <apex: page> 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 your 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

1. 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. 

2. Standard Controller Actions

The standard controller Actions are as follows:

1. 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.

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

3. 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.

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

3. 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 <apex: page> tag. For example :

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

</apex:page>

Checkout Salesforce Interview Questions

4. 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 <apex: pagemessage> or <apex:message> method under the <apex:page> to exhibit the error.  

5. 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 : 

Salesforce Administration Training Salesforce Lightning Training
Salesforce Advanced Developer Training Salesforce Developer Training
Salesforce IoT Training Salesforce App Builder Certification Training
Salesforce AppExchange Training Salesforce Service Cloud Training
and many more.  
Join our newsletter
inbox

Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!

Course Schedule
NameDates
Salesforce TrainingAug 05 to Aug 20
Salesforce TrainingAug 08 to Aug 23
Salesforce TrainingAug 12 to Aug 27
Salesforce TrainingAug 15 to Aug 30
Last updated: 04 August 2023
About Author
Remy Sharp
Arogyalokesh

Arogyalokesh is a Technical Content Writer and manages content creation on various IT platforms at Mindmajix. He is dedicated to creating useful and engaging content on Salesforce, Blockchain, Docker, SQL Server, Tangle, Jira, and few other technologies. Get in touch with him on LinkedIn and Twitter.

Recommended Courses

1 /15