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
Nathan MarchantNathan Marchant 

Visualforce: Error on SOQL from Extension

I basically have standard controller and an apex extension. I need the standard controller to get the current record ID. Then in my extension i use that id to find other related records. When i try to pull these fields from the extra object i get this error: 'Invalid field Title for SObject EmailMessage'

   

    <apex:page standardController="EmailMessage" extensions="EmailFilesApex" Action={!RunSOQL}>
            <apex:pageBlock title="My Content">
          <apex:pageBlockTable value="{!ERecords}" var="Record">
           <apex:column >
            <apex:facet name="header">Account Title</apex:facet>
            <apex:outputText value="{!Record.Title}"/>
           </apex:column>
           <apex:column >
            <apex:facet name="header">Id</apex:facet>
            <apex:outputText value="{!Record.Id}"/>
           </apex:column>
          </apex:pageBlockTable>
        </apex:pageBlock>
        
        </apex:page>

//Class

    public with sharing class EmailFilesApex {
    public String currentRecordId {get;set;}
    public String parameterValue {get;set;}
    public Account acc{get;set;}
    public List<ContentVersion> ERecords {get; set;}    
        
        public EmailFilesApex(ApexPages.StandardController controller) {
            currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        }
        
        public void RunSOQL(){
            ERecords = [SELECT Title, Id, FileType FROM ContentVersion WHERE FirstPublishLocationId =:currentRecordId];
    
        }
    }
AkshaySFDCAkshaySFDC
Please check the field API names on the ContentVersion Object, Particularly Title