1

I'm trying to render an item from one related list on PDF. the structure is following:
I have Sales Order, where is lookup field to Company, on Company is related list of Bank Accounts which I need to render. The Bank Accounts are related to Company through lookup, not master-detail. Here is code which I'm using:

<apex:repeat value="{!salesInvoice.c2g__OwnerCompany__r.c2g__BankAccounts__r}" var="account">  
<apex:outputText value="{!account.c2g__AccountName__c}" rendered="true" escape="false"/>
</apex:repeat>

But get an error:

Error: Aggregate Relationship is used in an unsupported complex expression containing 'c2g__OwnerCompany__r.c2g__bankaccounts__r'

Any ideas?

1

You cannot bind two levels down child relationships.

Your apex:repeat binding looks like this:

salesInvoice.c2g__OwnerCompany__r.c2g__BankAccounts__r

The problem is that c2g__OwnerCompany__r is a list. But you're trying to tell the interator to bind to a list within a list: c2g__OwnerCompany__r.c2g__BankAccounts__r.

This is not allowed.

In theory you could do something like:

<apex:repeat value="{!salesInvoice.c2g__OwnerCompany__r}" var="ownerCompany">  
  <apex:repeat value="{!ownerCompany.c2G__BankAccounts__r}" var="account">
    <apex:outputText value="{!account.c2g__AccountName__c}" rendered="true" escape="false"/>
  </apex:repeat>
</apex:repeat>

This would give you the ability to list all children of children.

  • 1
    Thanks for answer. Tried it and the error is still the same. In the second line the c2g__BankAccounts__r should be name of the lookup relationship on a Bank Account, right? – mascot May 12 '15 at 8:57
  • Didn't work for me – zaitsman Oct 31 at 6:10

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.