Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I receive the following error:

SObject row was retrieved via SOQL without querying the requested field: Installation__c.Name 

Controller extension on custom object:

public class CrewWorkDetailController{

    public final Installation__c installation {get; private set;}

    public CrewWorkDetailController(ApexPages.StandardController stdController)
        this.installation = (Installation__c) stdController.getRecord() ;


<apex:page standardController="Installation__c" extensions="CrewWorkDetailController">

This is based on this example. Any ideas?

I tried renaming my variable and still does not work.

share|improve this question
Try calling your variable something besides installation. – greenstork Jun 12 '14 at 15:59
I tried renaming my variable and still does not work. – d0001 Jun 12 '14 at 16:08
How are you testing this page that it's not working. Have you overrode the standard New or View for your custom object with your extension. A controller extension relies on a standard object controller to be passed into it. Just viewing an apex page for an extension could also lead to your error. – greenstork Jun 12 '14 at 16:17
@greenstork The code I put in the question is all I have. I clicked preview and appended id of installation to url. The answer provided by sfdcfox seems to be right. Thanks for your help. – d0001 Jun 12 '14 at 16:25
up vote 8 down vote accepted

The only fields that are queried by default are the fields that are explicitly bound to the main standard controller during the page's construction (before the constructor of your extension is called).

You have two choices here:

1) You can use StandardController.reset() and StandardController.addFields() to add Name as a field to query.

2) You can bind directly the standard controller's record by using the name of the object:

<apex:page standardController="Installation__c" extensions="CrewWorkDetailController">
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.