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
Frederick BunaoFrederick Bunao 

I need to display fields from a grandchild record to a Visualforce PDF rendered page on the grandparent record

Hello, I have no Apex experience or knowledge whatsoever, but I believe I may need some kind of Apex code for this.

Our org has a customer Product Object, which can have a Product Formula child object, and each Formula object will have Formula Items as a Junction Object between the Formula and Ingredient objects.

PRODUCT > FORMULA > FORMULA ITEM < INGREDIENT
        |_________________________|
We already have a Visualforce page that renders a PDF on the Product record that shows all the product details. It is easy and uses the standard controller. BUT I am now being asked to display all the Formula Items included in the formula for that product on the Visualforce Page. Even trickier, the grand child record needs to be based on a picklist value on the Product Record.

i.e.
Product X has Formula A, B, C
Product X's picklist says "Formula A"
Visualforce PDF page needs to look at Formula A and list every Formula Item in Formula A.
If someone changes the picklist to "Formula B" then Visualforce PDF page will show every Formula Item in Formula B.

If anyone can just show me a good, simple example that shows a Visualforce page, whether through custom Apex or not, that can conditionally display grandchild records on the grandparent record it would be an amazing start.