+ Start a Discussion
mohsin ahmad 11mohsin ahmad 11 

Do we need to create custom controller for the custom object ?

when we create a page, we make standard controller if we have to work on standard object like "Account". I want to know, do we need to make custom controller when working on custom object or simply we have to use customobject__c by using standard controller.
For eg: If I have a custom object Emplyee, then I have to make a custom controller with Employee__c or simply write standardcontroller="Employee__c".
Amit Chaudhary 8Amit Chaudhary 8
Hi Mohsin,

Yes you can use the standardcontroller with custom object as well.
To associate a standard controller with a Visualforce page, use the standardController attribute on the <apex:page> tag and assign it the name of any Salesforce object that can be queried using the Force.com API.

For example, to associate a page with the standard controller for a custom object named MyCustomObject, use the following markup
<apex:page standardController="MyCustomObject__c">
When you use the standardController attribute on the <apex:page> tag, you cannot use the controller attribute at the same time.

Please let us know if this will help you

Amit Chaudhary
Ajay K DubediAjay K Dubedi
Hi Mohsin, 
You need to use the full Object API name, which is the same as the name of the standard controller:
<apex:page standardController="Employee__c">
Salesforce includes standard controllers for every standard and custom object. Every standard controller includes a getter method that returns the record specified by the id query string parameter in the page URL. This method allows the associated page markup to reference fields on the context record by using {!object} syntax, where object is the lowercase name of the object associated with the controller. So it is not required to create custom controller.
Anand kurubaAnand kuruba
Hi mohsin
please follow this links:

zachary kylezachary kyle
Thanks For sharing this valuable information. if you like food this article is only for you guys.Wendy’s is an American multinational chain of fast-food restaurants. Wendy’s is the third-largest hamburger fast-food chain in the country. 

Wendy’s Breakfast Menu 2022