You need to sign in to do that
Don't have an account?
Nathan 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];
}
}
<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];
}
}
AkshaySFDC
Please check the field API names on the ContentVersion Object, Particularly Title