function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mark@rallymark@rally 

Custom Objects and Standard Controllers

Does Salesforce generate a standard controller when you create a Custom Object? If yes, how do you reference it? For example, here is how you reference a standard one like Account:

<apex:page standardController="account" tabStyle="RPMProduct__c">

Although tabSytle supports the Custom Object named RPMProduct, standardController does not. The RPMProduct page is using some controller. What controller does a custom object use? How do I use it in VisualForce?

Also is there a list of standard objects/controllers/fields to reference while developing with VisualForce or Apex code for that matter? The only method I know is to view the standard object and fields through Setup -> Customize in the Salesforce subscription (time consuming).

Thanks,
Mark
aezellaezell
"Also is there a list of standard objects/controllers/fields to reference while developing with VisualForce or Apex code for that matter?"

If you are using the Eclipse plugin, available here, then you should be able to double-click the .schema file in your Apex project. That launches the Schema Browser which gives you a way to see objects and fields and run queries on them easily right in the IDE. If you are on a Mac, and don't want to use Eclipse, there is also Simon Fell's SoqlXplorer which does similar things. In addition, it has a nice graphical schema view.

In addition to seeing all the standard objects, you will also see all your custom objects and fields as well.
mark@rallymark@rally
The Eclipse schema explorer is nice - thanks for the info!

Do you use VisualForce? Any thoughts on the controller for a custom object?
aezellaezell
I have been playing with Visualforce. I just tried several ways to specify a custom object controller. I don't think it can happen.

You'll probably need to build the controller by hand for any custom object, but I'm not 100% sure.
Ron HessRon Hess
each custom object has a standard controller, you can also write a custom controller for a standard or custom object


aezellaezell
Thanks Ron, you're totally right.

In my test, I kept writing "Positions__c" instead of "Position__c" so of course it didn't work.

Something like this:
Code:
<apex:page standardController="Position__c">
</apex:page>
should work fine for any custom object.
 

Message Edited by aezell on 09-28-2007 03:39 PM

mark@rallymark@rally
I thought I tried that many times, many ways. But going back and doing it again - it works! Must be Friday :smileyhappy:

Similar question but will create new post for clarity. Thanks for the help on this.
dchasmandchasman
A common mistake is to forget to use the API names for all references to standard/custom objects/fields/etc. We will be releasing (sometime after Winter '08) a bunch of additional quick fixes and fuzzy match quick fixes that will help with things like this (e.g. the system will recognize this situation and ask you if you really meant MyCustomObject__c instead of MyCustomObject or if you really wanted to create a new custom object called MyCustomObject and wire it up to the standardController attribute in your page).