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
ivantsyivantsy 

SObject row was retrieved via SOQL without querying the requested field

Hello!

 

When I am using {!item.SubmittedBy__c} field, I am always getting an error:

 

SObject row was retrieved via SOQL without querying the requested field: FLOGS_Access_Request__c.SubmittedBy__c

 

When I am using another fields from query, like {!item.AccessLevel__c}, I have no problem - the page is shown with AccessLevel__c field on it;

when I am using SubmittedBy__c and some other fields, I am getting that error.

 

Could somebody, please,  explain me, why page reads one filelds and does not see others?

 

SOQL statement in a custom controller:

 

      public List<FLOGS_Access_Request__c> getReq() {
            rqs = [select Id, CreatedById, CreatedDate, RequestedFor__c, RequestType__c, AccessLevel__c, 
                          LastModifiedDate, LastModifiedById, LastActivityDate, IsDeleted, SystemModstamp,
                          OwnerId, Name, Comments__c, Approver__c, ApprovalStatus__c,
                          Submitter_E_mail__c, Submitted_Date__c, SubmittedBy__c, TestField__c
                   from FLOGS_Access_Request__c
                   order by id];
                   return rqs;
      }
 

On VF page:

 

        <apex:pageBlockTable value="{!Req}" var="item" rowClasses="odd,even">
           <apex:column headerValue="Submitted By:">
              <apex:outputLink value="FLOGS_Access_Request_Detail">{!item.SubmittedBy__c}
                 <apex:param name="parReqBy" value="{!item.ID}"/>
              </apex:outputLink>
           </apex:column>

           ...
        </apex:pageBlockTable>
 

 

Thank you.