Slaesforce FAQ

how to fetch records in salesforce for custom controller

by Faustino Haley V Published 3 years ago Updated 2 years ago
image

How do I add data to a custom controller in Salesforce?

You need to use tag. It is a section of a Visualforce page that allows users to enter input and then submit it with an or . Also, I suggest to use tag.

How do I use a controller on a VF page?

Create a Visualforce Page that Uses a Custom Controller Add a custom controller to a Visualforce page by referencing the name of the controller class in the controller attribute. When your page uses a custom controller, you can't use a standard controller.

What is StandardController in Salesforce?

Standard Controller in Salesforce provides the ability to access and interact with structures business data contained in records and displays the data in the proper user Interface. StandardController attribute must be used on tag.

What is custom list controller in Salesforce?

A custom list controller is similar to a standard list controller. Custom list controllers can implement Apex logic that you define to show or act on a set of records. The list of sObjects returned by getRecords() is immutable. For example, you can't call clear() on it.

How many types of controllers are there in Salesforce?

There are basically two types of Controller in Visualforce page.

Can we use extension with custom controller?

A controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when: You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.

What is Pageblock in Salesforce?

An area of a page that uses styling similar to the appearance of a Salesforce detail page, but without any default content. This component supports HTML pass-through attributes using the "html-" prefix. Pass-through attributes are attached to the generated container

tag.

What is the use of Apexpages StandardController?

StandardController objects reference the pre-built Visualforce controllers provided by Salesforce. The only time it is necessary to refer to a StandardController object is when defining an extension for a standard controller. StandardController is the data type of the single argument in the extension class constructor.

What is recordSetVar in Salesforce?

The recordSetVar attribute indicates that the page uses a list controller and the variable name of the record collection. This variable can be used to access data in the record collection.

What is the difference between standard controller and standard list controller?

Standard controller encapsulates just a single Sobject (e.g. Account, Opportunity). Standard list controller contains a list of records (one or more), and has additional functions to facilicate paging (moving between pages) and updating a number of records at once.

How do you define a list controller?

Introduction to the Standard List Controller. The standard list controller allows you to create Visualforce pages that can display or act on a set of records. Displaying a list of records is a fundamental behavior of almost all web apps.

What is Visualforce controller?

A Visualforce controller is a set of instructions that specify what happens when a user interacts with the components specified in associated Visualforce markup, such as when a user clicks a button or link.

Introduction to Custom Controllers

Custom controllers contain custom logic and data manipulation that can be used by a Visualforce page.

Create a Visualforce Page that Uses a Custom Controller

Add a custom controller to a Visualforce page by referencing the name of the controller class in the <apex:page> controller attribute.

Create a Custom Controller Apex Class

A custom controller is just an Apex class, which you write yourself using the Developer Console.

Beyond the Basics

You might have noticed that this custom controller class doesn’t inherit from another class, nor does it implement an interface promising to conform to the requirements of a Visualforce controller. Even complex controllers don’t do these things, because there isn’t any such class to inherit from or interface to implement.

Add a Method to Retrieve Records

Create a getter method that runs a SOQL query that returns records you want to display on your page.

Add a New Action Method

Create action methods in your custom controller to respond to user input on the page.

Beyond the Basics

The header text for the first name and last name columns is hard-coded in this markup. But what if your users don’t all use English? The standard Salesforce user interface has translated versions of the field names for all standard objects, and you can provide your own translations for custom objects.

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9