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
DeptonDepton 

Error: outputField can only be used with SObject fields.

 

 

Error: Could not resolve the entity from <apex:outputField> value binding '{!xxxx__c}'. outputField can only be used with SObject fields.

 

Hi,

 

I am receiving this error, but the weird reason here is that I have the same code written for the same field type, etc.... and it works fine but for some strange reason I have created a few more field and now  I am trying to add them to the VF page and I am getting this error??

 

 

        </apex:pageBlockSection></div>
        <div style="page-break-after: auto;"><apex:pageBlockSection title="Account blalbla" columns="1" collapsible="false">
            <apex:outputField value="{!xxx__c}" />
            <apex:outputField value="{!yyy__c}" />
            <apex:outputField value="{!zzz__c}" />
        </apex:pageBlockSection></div>
        <div style="page-break-after: auto;"><apex:pageBlockSection title="Account Plan" columns="1" collapsible="false">
            <apex:outputField value="{!A__c}" />
            <apex:outputField value="{!B__c}" />
            <apex:outputField value="{!C__c}" />
            <apex:outputField value="{!D__c}" />
        </apex:pageBlockSection></div>

 

This is just some part of the code, however A__c or B__c, work fine.

But with the new fields I just created and want to add to the page (xxx__c, yyy__c) I got the error message!

 

Any suggestions??

 

Thank you!

Best Answer chosen by Admin (Salesforce Developers) 
Shebin-KVP Business SolnsShebin-KVP Business Solns

Hi Depton,

 

 <apex:outputField   can only be used with SObject fields that means you need to supply standard controller. for example   <apex:outputField value="{!Account.Name}" > is correct but  <apex:outputField value="{!xxx}" > is not correct becuase it is originated from controller class .So the solution is to replace all  apex:outputField  with apex:outputText for controller class variables.Hope this solves your problem.

 

All Answers

Shebin-KVP Business SolnsShebin-KVP Business Solns

Hi Depton,

 

 <apex:outputField   can only be used with SObject fields that means you need to supply standard controller. for example   <apex:outputField value="{!Account.Name}" > is correct but  <apex:outputField value="{!xxx}" > is not correct becuase it is originated from controller class .So the solution is to replace all  apex:outputField  with apex:outputText for controller class variables.Hope this solves your problem.

 

This was selected as the best answer
DeptonDepton

Thank you but I do not understant why it worked previously with all the other custom fields??