0

I have a page with a standard controller on a custom object:

<apex:page standardController="myObject__c" docType="html-5.0" >

    <apex:form >
       <apex:outputText value="{!myObject__c.Id} {!myObject__c.Amount__c} rendered="false"/>
    </apex:form>

    <c:myComponent objectId="{!myObject__c.Id}"
                   amount="{!myObject__c.Amount__c}"/>

</apex:page>

Based on the SF documentation I've added a non-rendered outputTextelement so that the fields are referenced on the page however this is still yielding the error.

SObject row was retrieved via SOQL without querying the requested field: pmt4__myObject__c.pmt4__Amount__c 

Even upon commenting out the custom component I am still receiving the error. I have verified that the fields are visible. Any ideas?

1
  • (1) There must be a syntax error in the hidden field as there's a missing " (2) is there a deliberate reason why the component is outside the form?
    – cropredy
    Nov 13, 2015 at 20:31

1 Answer 1

0

Try using this:

<apex:outputText value="{!myObject__c.Id}" rendered="false"/> 
<apex:outputText value="{!myObject__c.Amount__c}" rendered="false"/>

although I do not think it will matter.

I bet it is in your controller

It also depends on what your code in the controller is doing. If you are not calling getRecord() then the fields will not be included. Can you share your controller code?

This will work if the fields are included on the page as in your code or in my answer.(Is this your pattern?):

public MyObject__c rec {get;set;}
public Decimal amt {get;set;}

public MyController(ApexPages.StandardController con){
     rec = (MyObject__c)con.getRecord();
     amt = rec.Amount__c;

}

You must log in to answer this question.

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