You need to sign in to do that
Don't have an account?
Waqas Ali
Invalid field ContractNumber for SObject Opportunity
I have a button in Opportuinty page which calls myclass, i am trying to show the contracts in visual force page, my controler is Opportunity type so now i am getting error when i try to access the "ContractNumber" in SObject Opportunity, But i need to use Opportunity controler. NOw how should i access ContractNumber and Status in Visual force page.
Here is my Visual force page.
<apex:page standardController="Opportunity" extensions="myclass" action="{!autoRun}"> <apex:pageBlock title="My Contracts"> <apex:pageBlockTable value="{!Records}" var="Record"> <apex:column > <apex:facet name="header">Contract Name</apex:facet> <apex:outputText value="{!Record.Name}"/> </apex:column> <apex:column > <apex:facet name="header">Contract Number</apex:facet> <apex:outputText value="{!Record.ContractNumber}"/> </apex:column> <apex:column > <apex:facet name="header">Contract Status</apex:facet> <apex:outputText value="{!Record.Status"/> </apex:column> </apex:pageBlockTable> </apex:pageBlock> </apex:page>Here is my class.
public class myclass { String theId = ApexPages.currentPage().getParameters().get('id'); public List<Contract> Records {get; set;} public myclass(ApexPages.StandardController stdController) { this.o = (Opportunity)stdController.getRecord(); } public PageReference autoRun() { Records = [select Name, AccountId, StartDate, Status, ContractNumber from Contract where Status='Pending']; return null; }I am new to salesforce , may be its too easy but for me its difficult. Guys any Help !
Thanks
JD
Exact wording
error:Invalid field ContractNumber for SObject Opportunity
and VF Page
Thanks,
Himanshu