You need to sign in to do that
Don't have an account?

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.
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.
It works fine in my org. Can you see if you have Read,Create permission on Opportunity Object for your profile?
Thanks