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
SeanMSSeanMS 

Displaying Data Two Levels Deep: Guidance needed on Controller Extension and VF Display Code

Hello!

 

I need some guidance on writing a controller extension and displaying it in VisualForce. I’ve been searching the forums and documentation, but can’t seem to wrap my head around how to get this to work. Here are the details…

 

I have the following custom object hierarchy for which I need to display data in one section of the parent object layout (Order)...

 

Order (Master of Shipping_Location)

     |

      --------> Shipping_Location (Detail of Order, An Order can have multiple Shipping_Locations)

                         |

                          --------> Item (Lookup Relationship with Shipping_Locations, A Shipping_Location can have multiple Items)

 

So, an example of what the data might look like for one Order object is this...

------------------------------------------------------------

Order Number: 2000

 

            Shipping Location: Seattle, Wa

                        Item 1: Red Ball

                        Item 2: Green Ball

                        Item 3: Yellow Ball

 

            Shipping Location: Cleveland, OH

Item 1: Yellow Ball

Item 2: Pink Ball

------------------------------------------------------------

 

I am able to display the Order and Shipping_Location data without issue using only a VisualForce Page (I am displaying the Shipping_Location data in a repeat tag). The issue that I cannot figure out is how to best display the Item details for each Shipping_Location, understanding that each Item is mapped to the current Shipping_Location’s unique Id.


I believe that the use of a controller extension is my answer, but I’m sketchy at figuring out the syntax and how to link it to my VF page (I only want to display the data – no form fields etc.) Another tricky part for me has been that I need to somehow pass the current Shipping_Location unique Id as a parameter so that when I query the Item object, that I am retrieving only those Items linked to the current Shipping_Location object.

 

Can someone please guide me to an example that closely matches mine (access to data two levels deep) or show me some controller and VF code that I can use to get started? I’m very new to this. Thanks for your help in advance!

SeanMSSeanMS

Please disregard this request for help. I've been able to get past several of my issues and am left with only one now (parameters and controllers) that I will post a separate message.