function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ErrorProneErrorProne 

Assets and the visualforce page (Child / Parent)

Tough one here. 

 

I should prefece this post by stating that I am using Professional which doesn't allow me to write my own apex classes.

 

I have a custom object thats a child of the account page.

 

Can't seem to list the Accounts Opportunities and the accounts assets onto the childs page. 

 

Is this impossible? 

 

here is some code i/ve attempted. 

<apex:repeat value="{!Account_Management__c.Account__r.assets}" var="prod">
 <tr>
  <td>{!prod.Asset_Type__c}</td>
 </tr>
</apex:repeat>

 Result:

Aggregate Relationship is used in an unsupported complex expression containing 'Account__r.assets'

 

any advice would be awesome Thanks

bob_buzzardbob_buzzard

According to the docs you can't do this:

 

--- snip ---

 

  • You can traverse up to five levels of child-to-parent relationships. For example, if using the Contact standard controller, you can use {!contact.Account.Owner.FirstName} (a three-level child-to-parent relationship) to return the name of the owner of the account record that is associated with the contact.

  • You can traverse one level of parent-to-child relationships. For example, if using the Account standard controller, you can use {!account.Contacts} to return an array of all contacts associated with the account that is currently in context. 

--- snip ---

 

However, what you are trying to do is go up one level to the related account and then down to its children.

 

One way that might work is to use an apex:iframe component that pulls in another visualforce page using the account standard controller. If you pass that the value of Account_Management__c.Account__c as a parameter, that page can then access the child assets for the account in question.