[SalesForce] Error: Could not resolve the entity from value binding – VF Component

UPDATED:

The below answer was incomplete and here is the complete answer to my question:

If you really want an Sobject type declare attribute as an sobject

<apex:attribute name="CaseNumber" description="Case Number" type="<name_of_your_object>" required="true"/>

<apex:inputField id="cn" value="{!CaseNumber.<field_name>}"/>

Hope this will help others.

I'm creating a VF Component page and I'm not sure why I'm getting this error:

Error: Could not resolve the entity from value
binding '{!CaseNumber}'. can only be used with
SObjects, or objects that are Visualforce field component resolvable.

<apex:component>

    <apex:attribute name="CaseNumber" description="Case Number" type="String" required="true"/>    

 <apex:pageBlockSection title="Item Detail " columns="1" showHeader="true" > 
      <apex:outputPanel layout="none">
       <table class="list" border="0" cellpadding="0" cellspacing="0"  >
         <tr >
           <td>Case Number</td>
           <td style="text-align:left;"><apex:inputField id="cn" value="{!CaseNumber}"/></td>
         </tr>
       </table>
 </apex:outputPanel>
</apex:pageBlockSection>

</apex:component> 

Best Answer

The problem here is you are using apex:inputField that requires an Sobject .

If your attribute type is String just use apex:inputText instead

<apex:inputText id="cn" value="{!CaseNumber}"/>

If you really want an Sobject type declare attribute as an sobject

<apex:attribute name="CaseNumber" description="Case Number" type="Case" required="true"/>
Related Topic