+ Start a Discussion
kumulankumulan 

Generating a PDF of a contact record with lots of related list data

Hello, 
I need to generate a nicely formatted PDF document that displays data for one contact record. The problem I am having is getting at the related objects/records - I've got about 10 objects attached to the Contact object for which I have to show all record data.  According to the VF guide (page 60, "Accessing Data With A Standard Controller"), which says

 

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.

 

I thought I would be able to create arrays to feed into pageblock tables with the following syntax: {!contact>.<name_of_custom_object>} but I'm getting the error: "Error: Invalid field "object name" for SObject Contact"

 

Do I have to create custom controllers to get this done or am I missing something simple?

 

Thanks in advance for any help you may have, kumulan

Best Answer chosen by Admin (Salesforce Developers) 
sguptasgupta
You should use the relationship name not the object name...ex - customobject__r

All Answers

sguptasgupta
You should use the relationship name not the object name...ex - customobject__r
This was selected as the best answer
kumulankumulan

Thanks sgupta, you're a star. Always something simple....

 

kumulan