0

Hi in the below visualforce code i am unable to display orderItem related list .the custom related list object orderItem is a managed package, to show the related list i have taken the masterdetail relationship field's Child Relationship Name 'E_OrderItems' and refer to it as "E_OrderItems__r" in the template. but i am getting error like "Error: Invalid field E_OrderItems__r for SObject ccrz__E_Order__c"

Required immediate assistance in this regard ,Advance Thanks

<messaging:emailTemplate subject="Order Update Confirmation" recipientType="Contact" relatedToType="ccrz__E_Order__c">
<messaging:htmlEmailBody >
<style type="text/css">
body {
    background-color:#2F2F2F;
}

table {
  background-color: #FFFFFF;
    border: 2px solid;
    
    webkit-border-radius: 10px;
    moz-border-radius: 10px;
}

th{
    color: #0d6bab;
    font-family: ProximaNovaBold, Arial, Helvetica, sans-serif;
}
</style>

    <html>

            <body>

            <table>
                <tr>
                    <th>{!relatedTo.Name} placed an order. Current order status is: Order Submitted</th>    
                </tr>
                <tr><th style="text-align: left">Order Number :{!relatedTo.SAP_Order_Number__c}</th></tr>
            </table>
            <br/>
            <table>
                <tr>
                    <th style="padding-bottom: 20px;width:450px; text-align: left;">Billing and Shipping Address</th>  
                         
                </tr>
                 <tr>
                    <th style="color:#000;width:100px; text-align: left;font-size: 13px; ">Bill To  </th>
                    <th style="color:#000;width:100px;font-size: 13px;padding-right: 50px;">Ship to</th>
                     
                </tr>
                <tr>
                    <td style="color:#000;width:100px; text-align: left; ">{!relatedTo.SAP_Order_Number__c} </td>
                    <td style="color:#000;width:100px;padding-right: 50px;font-size: 13px;">text</td>
                     
                </tr>
            </table>
           
            <table>
                <tr>
                    <th>Order Items</th>    
                </tr>
                <br/>
                <tr>
                    <th style="color:#000;width:100px;">Product</th>
                    <th style="color:#000;width:100px;">Price</th>
                    <th style="color:#000;width:100px;">Qty</th>
                    <th style="color:#000;width:100px;">Total</th>    
                </tr>
                 <apex:repeat var="noteToDis" value="{!relatedTo.E_OrderItems__r}">
              <tr>
                 <td >{!noteToDis.ccrz__Product_Name__c}</td>
                <td >{!noteToDis.ccrz__Price__c)} </td>
                
              
                <td >{!noteToDis.ccrz__Quantity__c} </td>
                <td >{!noteToDis.ccrz__ItemTotal__c)}</td>
              </tr>
          </apex:repeat>    
            </table>
            <br/>
            <table>
                <tr>
                    <th>Totals</th>    
                </tr>
            </table>
           
            </body>

        </html>

    </messaging:htmlEmailBody>

</messaging:emailTemplate>
1

Because this is a managed package, presumably the child list is also part of the managed package

Thus, your apex:repeat needs to namesapce the relationship name

You have:

<apex:repeat var="noteToDis" value="{!relatedTo.E_OrderItems__r}">
          

You need:

<apex:repeat var="noteToDis" value="{!relatedTo.ccrz__E_OrderItems__r}">
          

PS: Community etiquette discourages appeals for immediate assistance

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.