Ok so im at a lost and hopefully someone can help me. So SF reporting is very limited and I need to pull a report that I can show to the user and allow for them to export to excel if needed. So here we go:

I have an object called wineclub and it is related to a contact. A contact can be referred by another contact which is listed on their record. What we need to display is the following in one row (is this even possible).

ContactID ContactName WineclubID WineClub WineclubStartDate ContactPrimeShippingAddress ContactEmail ReferredBy (related contact)

and related to that contact the referred by info of

ReferredbyContactID ReferredbyContactName ReferredbyWineclubID ReferredbyWineClub ReferredbyWineclubStartDate ReferredbyContactPrimeShippingAddress ReferredbyContactEmail

I tried using a cross filter and a joined report in SF but had no luck so thinking ill see if VF can help me accomplish my goal.

Any thought or help would be awesome......

  • Oh forgot to mention I have started my VF page to do a date rage lookup so the user can choose the wineclub start dates they want to see. Hopefully that does not make it to complicated Commented Feb 18, 2015 at 19:17

2 Answers 2


You can definitely do this with Visualforce, although, the export to Excel part will become more difficult. It seems you could do this with a custom report type without too much difficulty. I am not sure if your related contact (Referrer) is related on the wineclub record or on the contact record, but it should work in either case.

What you will need to do is create a Custom Report Type (Setup | Build | Create | Report Types) that relates the contact and wineclub records together. Then,go to the Edit Layout section of the CRT to add the related contact. This is done by selecting object the related contact is joined to (either the contact or the wineclub) in the "View" box on the right side of the screen. Then, select the "Add fields related via Lookup" link. This should show your related Contact, select it, and drill down and select the fields you want from the related object. To make the report easier to work with, create a separate section, using the "Create New Section" button, and move all of the new Related fields to that section.

  • Thanks Jim never new you could do this with report. I was able to get the added section in but only issue im having now is getting the wineclub Id / WineClub / and start date for the referred by record. Commented Feb 18, 2015 at 21:32
  • If the data is too indirect, you might have to add a formula field to the available record that displays the necessary data elements.
    – JimRae
    Commented Feb 18, 2015 at 22:00
  • So thought about that but because the wineclub is a child of the contact (contacts have more then one wineclub) when I try to do a formula field on the contact field I cant get the information. Commented Feb 18, 2015 at 22:27
  • So, how would the report know which wineclub information to et from the referred record, if there could be more than one? You are starting to get your self into an area where you are going beyond the straight hierarchical reporting relationship. Not even sure how you would represent it in the table if you have that many levels and multiple one to many relationships.
    – JimRae
    Commented Feb 20, 2015 at 13:32

Yes you can do this. Create a new class with properties that you want to show. Create and populate new list of that class. Show that in vf :)

  • Welcome to SFSE. Can you expand on this a little and provide an example, including how to layout the data etc. on the page and how to do the export? As it is this answer isn't particularly useful :)
    – Matt Lacey
    Commented Feb 19, 2015 at 4:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .