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
RockfordRockford 

Accessing Data Across Multiple Objects -- How?

I'm a Visualforce newbie, so apologies for the very basic question:

 

Is it possible to access data across multiple objects (standard and custom) and then present in a single Visualforce page? If so, how is this accomplished?

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
gtuerkgtuerk

You'll find 100 ways to do this.  My favorite way is to create ViewObjects (custom classes) from DataTransformationObjects that hold the customized model for display in Visualforce.  You'll need to use a ControllerExtension.  If you are keeping the objects distinct (like a pageBlockSection for Account info and a page Block Table for Contacts) then just use member instances in your controller of the records/lists.  If you need to blend the two in markup, I'd recommend the custom class approach.

 

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_controller_quickstart.htm

 

Check out the blog roll on the technical library.  There are soooo many examples that a little digging will pay dividends

 

http://blog.sforce.com/

All Answers

gtuerkgtuerk

You'll find 100 ways to do this.  My favorite way is to create ViewObjects (custom classes) from DataTransformationObjects that hold the customized model for display in Visualforce.  You'll need to use a ControllerExtension.  If you are keeping the objects distinct (like a pageBlockSection for Account info and a page Block Table for Contacts) then just use member instances in your controller of the records/lists.  If you need to blend the two in markup, I'd recommend the custom class approach.

 

http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#StartTopic=Content/pages_controller_quickstart.htm

 

Check out the blog roll on the technical library.  There are soooo many examples that a little digging will pay dividends

 

http://blog.sforce.com/

This was selected as the best answer
RockfordRockford

Thank you!