14

I have a custom object called "Shows." I'm writing a VisualForce page to display some custom data. My code is:

<apex:page standardController="Show__c">
    <apex:pageBlock id="thePageBlock" >
        <apex:pageBlockSection title="Private Event Detail" columns="1">
            <p>Account: {!show.PE_Account__c}</p>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

When I save this, I get the following error message:

Error: Unknown property 'Show__cStandardController.show'    

I'm not using an extension here because as I understand from the documentation, I shouldn't need one. But perhaps I'm understanding it incorrectly. The Visualforce documentation says:

Salesforce includes standard controllers for every standard and custom object.

and

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.

I take this all to mean that I should be able to access data using the {!show} syntax. Clearly that doesn't work.

2
  • Have you tried {!show__c.PE_Account__c}?? Commented Nov 5, 2013 at 1:14
  • 1
    I tried a bunch of permutations and combinations. The answer below nails it. I wish the documentation was more clear for newbies.
    – eyedar
    Commented Nov 5, 2013 at 1:28

1 Answer 1

15

You need to use the full Object API name, which is the same as the name of the standard controller:

<apex:page standardController="Show__c">
    <apex:pageBlock id="thePageBlock" >
        <apex:pageBlockSection title="Private Event Detail" columns="1">
            <p>Account: {!Show__c.PE_Account__c}</p>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .