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
Surender reddy SalukutiSurender reddy Salukuti 

opportunity error

Hi ,
i wrote program using combination of appex and visual force 

apexprogram-
public class Example_pr2 {
    public account acc {set;get;}
    public opportunity opty {set;get;}
    
    
    public Example_pr2(){
        acc= new account();
        opty =new opportunity();
    }

}
and visual force program 
<apex:page controller="Example_pr2">
    <apex:form>
    <apex:pageblock>
        <apex:pageBlockSection title="Account">
         <apex:inputField value="{!acc.name}"/>
         <apex:inputField value="{!acc.phone}"/>
         <apex:inputField value="{!acc.industry}"/>
          <apex:inputField value="{!acc.rating}"/>
          <apex:inputField value="{!acc.ownership}"/>
        
        </apex:pageBlockSection>
        <apex:pageBlockSection title="opportunity">
            <apex:inputField value="{!opty.name}"/>
            <apex:inputField value="{!opty.StageName}"/>
            <apex:inputField value="{!opty.closedate}"/>
            <apex:inputField value="{!opty.Amount}"/>
          </apex:pageBlockSection>
        </apex:pageblock>
    </apex:form>
 </apex:page>

but i am getting error in opportunity fields 
error message-
Could not resolve the entity from <apex:inputField> value binding '{!opty.name}'.  <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.


 
Meghna Vijay 7Meghna Vijay 7
Hi ,

It works fine in my org. Can you see if you have Read,Create permission on Opportunity Object for your profile?
User-added image
Thanks
 
Surender reddy SalukutiSurender reddy Salukuti
Thanks for your replay , i have access but i am not getting output if you find issue please tell me Thanks