0

Error: Unknown property 'OpportunityStandardController.line2

here is my code up to where I get stuck:

<apex:page standardController="Opportunity" showHeader="false" renderas="pdf">

<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">
    <p align="right">
        <img src='{!URLFOR($Resource.SF_Logo_TI)}' title="logo" /></p>
        <tr align="right">    <td><font face="Arial"></font>        
</td></tr>
<hr/>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%" id="table1">

        <td width="0%"></td>
   <td align="left"><font face="Arial">Invoice number: <apex:repeat value="{!Opportunity.Invoices__r}" var="line2">
   {!line2.name}</apex:repeat></font><br/>

   <font face="Arial">Invoice Date: <apex:outputText value="{0,date,MM/dd/yyyy}">
        <apex:param value="{!line2.Invoice_Date__c}"/>
        </apex:outputText></font></td>

I am trying to show the standard date format, I was using apex:repeat which was giving me the dd.mm.dd 00:00:00 yyyy

  • 1
    can you put a bit more code ? where line2 is coming from ? – Cloud Ninja Oct 27 '16 at 0:13
1

You've closed your <apex:repeat> tag early. The only reason line2 is defined when you output its name is because you have defined it by your var attribute on that <apex:repeat>.

Works

<apex:repeat value="{!Opportunity.Invoices__r}" var="line2">
    <!-- inside this repeat tag, line2 is defined -->

    {!line2.Name}
    <apex:outputText value="{!0,date,MM/dd/yyyy}">
        <apex:param value="{!line2.Invoice_Date__c}" />
    </apex:outputText>

</apex:repeat>

Fails

<apex:repeat value="{!Opportunity.Invoices__r}" var="line2">
    <!-- inside this repeat tag, line2 is defined -->

    {!line2.Name}

</apex:repeat>

<!-- outside the repeat tag, line2 is not defined -->
<apex:outputText value="{!0,date,MM/dd/yyyy}">
    <apex:param value="{!line2.Invoice_Date__c}" />
</apex:outputText>

As a side note, you may find that consistent indentation and spacing will make it easier to tell how your components are nested.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.