+ Start a Discussion
DimitrisDimitris 

Visual Force - Error: Unknown property 'OpportunityStandardController.Contract'

Hi 
I am new in this field and still learning; I tried to add the below to display some information from my product in the T&Cs
but it returns the following error Error: Unknown property 'OpportunityStandardController.Contract'​

 <apex:repeat value="{!Contract.Opportunity_Product__r}" var="line">
            <tr>      
                <td>{!line.Product2.Name}</td>
                <apex:outputText rendered="{!If(line.Product2.Early_Termination_Clause__c!=Null,True,False)}">
                    <td style="text-align:center">{!line.Product2.Early_Termination_Clause__c}</td>
                </apex:outputText>  
                <apex:outputText rendered="{!If(line.Product2.Early_Termination_Clause__c==Null,True,False)}">
                    <td style="text-align:center">No Clause Available</td>
                </apex:outputText>  
            </tr>
        </apex:repeat>
Rahul.MishraRahul.Mishra
Hi,

Here:
<apex:repeat value="{!Contract.Opportunity_Product__r}" var="line">, does !Contract.Opportunity_Product__r returns the list of records, seems it is a lookup and will return only one record.
Instead of using apex:repeat, you can use it this way:

            <tr>      
                <td>{!Opportunity.Contract.Opportunity_Product__r.Product2.Name}</td>
                <apex:outputText rendered="{!If(!Opportunity.Contract.Opportunity_Product__r.Product2.Early_Termination_Clause__c!=Null,True,False)}">
                    <td style="text-align:center">{!!Opportunity.Contract.Opportunity_Product__r.Product2.Early_Termination_Clause__c}</td>
                </apex:outputText>  
                <apex:outputText rendered="{!If(!Opportunity.Contract.Opportunity_Product__r.Product2.Early_Termination_Clause__c==Null,True,False)}">
                    <td style="text-align:center">No Clause Available</td>
                </apex:outputText>  
            </tr>

Mark it solved if it does help you.
DimitrisDimitris
Hi Rahul,

Thank you for the quicke response - while adding your suggestion it shows me the following error
Error: Unknown property 'VisualforceArrayList.Product2'


 
Rahul.MishraRahul.Mishra

Seems Product2 should not be there, assuming your custom field is lookup to product, could you please try below code:

           <tr>      
                <td>{!Opportunity.Contract.Opportunity_Product__r.Name}</td>
                <apex:outputText rendered="{!If(!Opportunity.Contract.Opportunity_Product__r.Early_Termination_Clause__c!=Null,True,False)}">
                    <td style="text-align:center">{!!Opportunity.Contract.Opportunity_Product__r.Early_Termination_Clause__c}</td>
                </apex:outputText>  
                <apex:outputText rendered="{!If(!Opportunity.Contract.Opportunity_Product__r.Early_Termination_Clause__c==Null,True,False)}">
                    <td style="text-align:center">No Clause Available</td>
                </apex:outputText>  
            </tr>
DimitrisDimitris
Now i am getting the same but with 
Error: Unknown property 'VisualforceArrayList.Name'

Basicacally what i am trying to achieve is to display the text of the field Early termination clause for each product.