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
rDr4g0nrDr4g0n 

related lists for a non child custom object

I am working on a visualforce page and I would like to display a list of custom objects that have the current Account as their account. The layout editor for the default Account page lets me simply add this custom object as a Related List, but the custom object is not actually in the Account objects list of properties.

 

So, first I am confused about the relationship between the custom object and Account, and 2 how can I implement that Related List in visualforce in the same way that it appears in the default Account object.

 

Thanks in advance!

MikeGinouMikeGinou

Your visualForce controller will need to use the Account StandardController. If you are already using a custom controller, then you will have to specify your custom controller as an extension controller (this will also require you to implement a special constructor).

 

After you do this, you should be able to add the Visual Force page to the standard Account Layout. However, it will not appear in the same way as a related lists. Instead, you'll be able to add it as a field on the layout. You can create a new one-column section for it, though, which is getting pretty close to the look you are trying for.

 

Some relevant sections from the VisualForce guide:

Standard Controllers

Extension Controllers