Visualforce page for searching records using Custom Controller.

Visualforce page for searching records using Custom Controller.

A Visualforce page for searching records can be created as follows:


Create a new Visualforce page in the Salesforce setup and give it a name, e.g. “SearchRecordPage“.

Add the following code to the Visualforce page:

Visualforce Page:

Visualforce page for searching records using Custom Controller.


Apex Controller:



Note: Replace [ObjectName] with the actual name of the object you want to search records for, and Field1__c and Field2__c with the actual field names of the object.


This will create a Visualforce page that allows users to search for records in the specified object, using a search term entered in the apex:inputText field. The search results will be displayed in a table using apex:pageBlockTable. The apex:commandButton with the “Search” label will trigger the search when clicked. 

The search results will be retrieved from the database using a SOQL query in the Apex controller.

Leave a Reply

Your email address will not be published. Required fields are marked *