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
Brooks Johnson 6Brooks Johnson 6 

Export a Related List

I need to build a button that links to visual force page so my users can export directly to Excel.  But I am getting errors trying to connect to the related lists. I related list is called "influencers" It is a list on a custom object called Lists. The related list are contacts that are connected via a junction object calls Relationship Owner.  Lists__c , Relationship_Owner__C and Contacts.  On Schema Builder the name of the relationship from Lists to Releionship_Owner is "lists"

If I try to access via <apex:relatedlist/> I get an error that "Contacts is not a valid child relationship name for entity list.  I get the same error if I try to use <apex:relatedlist list ="lists__r>

I have also tried to build a table that connected all three via dot notation and still can get the related list to appear.  Pretty new to Visualforce and Salesforce Development. Any help would be great. 
<apex:page standardController="Lists__c">
    <apex:pageBlock title="Influencers">    
    	<apex:pageBlockTable value="{!Lists.Lists__r.contacts}" var="contacts">        
   	    </apex:pageBlockTable>        
   </apex:pageBlock>
</apex:page>

 
Alain CabonAlain Cabon
Hi Brooks,

The new button will be added to an existing related list called "influencers" on Lists__c.

That could be interesting to export the metadata definition of the layout of Lists__c with the workbench (easy) and you will find the relationship name clearly written into it directly.

1) Create a text file package.xml with the xml definition below (first line:<?xml version ... last line:</Package>)

(  https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_layouts.htm )

Lists__c = object 
Lists Layout = name of the layout (could be different but it appears clearly in the top left corner when you edit the layout)
 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Lists__c-Lists Layout</members>
        <name>Layout</name>
    </types>
    <version>42.0</version>
</Package>

2) Connect to the workbench (production/sandbox) with the credentials of the targetted org (if needed). 

https://workbench.developerforce.com/login.php

3) Menus: migration > retrieve

4) Choose your Unpackaged Manifest: package.xml and check the Single Package​ + button: Next + button:Retrieve + link: Download ZIP File ​

5) the file Lists__c-Lists Layout.layout (xml file) into the folder "layouts" of the zip file contains the <relatedLists> defintion and you will find your relationship clearly.

3) Creating Export to Excel Button on Related List using Visualforce Page
https://developer.salesforce.com/forums/?id=906F0000000AXBwIAO

Alain
Brooks Johnson 6Brooks Johnson 6
Hi Alain, Thank you for your help. I am sorry it took me a bit to get back to you. I had a couple other projects going on. I was able to export the relationship from the workbench but I am still getting an error. Maybe I am not using the right name? I am including the Workbench results below and my code. 
 
<?xml version="1.0" encoding="UTF-8"?>

-<Package xmlns="http://soap.sforce.com/2006/04/metadata">


-<types>

<members>Lists__c-Lists Layout</members>

<name>Layout</name>

</types>

<version>42.0</version>

</Package


//My code for the data table

<apex:page standardController="Lists__c">
    <apex:pageBlock title="Influencers">    
    	<apex:pageBlockTable value="{!Lists__c.members__r}" var="contacts">        
   	    </apex:pageBlockTable>        
   </apex:pageBlock>
</apex:page>
I get an error that says Invalid field members__r for SObject Lists

Thank you again for your help. 
Alain CabonAlain Cabon
Hello Brooks,

In fact, the metadata of the layout shows how the engine of Salesforce will resolve the access to the data of the related list but it is not exactly the "relationship name" but what fields and objects are used by the relationship for the related list.

Could you copy/paste the part of <relatedLists>...</relatedLists> which is used by the related list ?

You have found  <relatedList>member__c.Lists__c</relatedList>  or <relatedList>Contact.Lists__c</relatedList>

 Alain
Brooks Johnson 6Brooks Johnson 6
Hi Alain, 

I am sorry, but I am not following along very well. What part should I copy and paste for you. Thank you for helping me with this. 
Alain CabonAlain Cabon
Hi Brooks,

In fact, it is not the package below that we wanted (also got in the response of the retrieve process indeed).

<members>Lists__c-Lists Layout</members> is used here for a request to the workbench and with the "retrieve" process we can get the layout details in the folder layouts of the zip response file.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Lists__c-Lists Layout</members>
<name>Layout</name>
</types>
<version>42.0</version>
</Package

The code above just says for the retrieve operation that it is for the layout metadata named Lists Layout of the object Lists__c.
There are 5 steps (explained above). If you just get the package.xml in response that means that either the layout name of the object name are wrong for the request.

It is quite tricky for your need but this operation (rarely made at the beginning) with the metadata could help you generally in the future for other needs.

For just a relationship name, it is quite complicated but no much in fact.
 
Alain CabonAlain Cabon
There are 5 steps (explained above). If you just get the package.xml in response that means that either the layout name or the object name is wrong for the request.
Brooks Johnson 6Brooks Johnson 6
I am still getting the message "Entity of type 'Layout named 'Lists__c List 2 Layout' cannot be found. 

My Schema looks like this. User-added image

The object name is  Lists__c User-added image

Layout is List 2 Layout User-added image

But my XML Package is not working.   
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Lists__c-List 2 Layout</members>
<name>Layout</name>
</types>
<version>42.0</version>
</Package

 
Alain CabonAlain Cabon
Hi Brooks, 

Your package is correct and I have reproduced the export without problem creating the same object and layout name. Strange.

The work-around is to get all the layouts (the result file is never huge because it is a zip file of text files).

Just use the asterisk (*) for members (means all of them).

My first try (just now): unrestricted list of layout.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>*</members>
<name>Layout</name>
</types>
<version>42.0</version>
</Package
My second try just now with this restricted list of layout (just one): success: true
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Lists__c-List 2 Layout</members>
<name>Layout</name>
</types>
<version>42.0</version>
</Package>

User-added image


Alain
Brooks Johnson 6Brooks Johnson 6
Ok, Got it to work. Not sure what happened there. There is one related list with the following 
<relatedList>List_Contact_Association__c.List__c</relatedList>

I am little confused. I don't have any objects names List or List_Contact_Assocation. 
Brooks Johnson 6Brooks Johnson 6
I am getting an error Invalid field List_Contact_Association__r for SObject Lists__c if I use <apex:relatedlist>  or <a[ex:pageBlockTable> I have inclded the xml file. And thank you again for your help Alain. 
<?xml version="1.0" encoding="UTF-8"?>
<Layout xmlns="http://soap.sforce.com/2006/04/metadata">
    <excludeButtons>ChangeOwnerOne</excludeButtons>
    <excludeButtons>ChangeRecordType</excludeButtons>
    <excludeButtons>Clone</excludeButtons>
    <excludeButtons>Share</excludeButtons>
    <excludeButtons>Submit</excludeButtons>
    <layoutSections>
        <customLabel>false</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>true</editHeading>
        <label>Information</label>
        <layoutColumns>
            <layoutItems>
                <behavior>Required</behavior>
                <field>Name</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>List_Group__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Region__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>List_Owner__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Edit</behavior>
                <field>Description__c</field>
            </layoutItems>
            <layoutItems>
                <behavior>Readonly</behavior>
                <field>Total_Influencers_on_List__c</field>
            </layoutItems>
        </layoutColumns>
        <layoutColumns/>
        <style>TwoColumnsTopToBottom</style>
    </layoutSections>
    <layoutSections>
        <customLabel>false</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>true</editHeading>
        <label>System Information</label>
        <layoutColumns/>
        <layoutColumns/>
        <style>TwoColumnsTopToBottom</style>
    </layoutSections>
    <layoutSections>
        <customLabel>true</customLabel>
        <detailHeading>false</detailHeading>
        <editHeading>true</editHeading>
        <label>Custom Links</label>
        <layoutColumns/>
        <layoutColumns/>
        <layoutColumns/>
        <style>CustomLinks</style>
    </layoutSections>
    <relatedLists>
        <fields>Contact.Full_Name__c</fields>
        <fields>Account.ACC_NAME</fields>
        <fields>Contact.CNTC_TITLE</fields>
        <fields>Contact.Influencer_Type__c</fields>
        <fields>Contact.Sector__c</fields>
        <fields>Contact.New_Relationship_owner1__c</fields>
        <fields>Contact.Do_Not_Contact__c</fields>
        <relatedList>List_Contact_Association__c.List__c</relatedList>
        <sortField>Contact.Full_Name__c</sortField>
        <sortOrder>Asc</sortOrder>
    </relatedLists>
    <showEmailCheckbox>false</showEmailCheckbox>
    <showHighlightsPanel>false</showHighlightsPanel>
    <showInteractionLogPanel>false</showInteractionLogPanel>
    <showRunAssignmentRulesCheckbox>false</showRunAssignmentRulesCheckbox>
    <showSubmitAndAttachButton>false</showSubmitAndAttachButton>
    <summaryLayout>
        <masterLabel>00h36000004y7K5</masterLabel>
        <sizeX>4</sizeX>
        <sizeY>0</sizeY>
        <summaryLayoutStyle>Default</summaryLayoutStyle>
    </summaryLayout>
</Layout>
Alain CabonAlain Cabon
Ok, we also need the metadata description of the object Lists__c and  Relationship_Owner__c​.

List_Contact_Association__c 
is not correctly resolved indeed.

The expected value was Relationship_Owner__c​ (?)

A new: package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account</members>
        <members>Contact</members>
        <members>Lists__c</members>
        <members>Relationship_Owner__C</members>
        <name>CustomObject</name>
    </types>
    <version>42.0</version>
</Package>

Do you find the value List_Contact_Association__c and List__c into the new exported files of the objects with the workbench?

I don't know your fields (nor your relationships) and all should be clear into the metadata of the layout + the objects.
Alain CabonAlain Cabon
<members>Relationship_Owner__c</members>

Copy/paste the exact name with the correct case.
Brooks Johnson 6Brooks Johnson 6
I ran the XML and verified the names of the custom objects in the Object Manager. But I am getting an error that the two custom objects can not be found. 
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Account</members>
        <members>Contact</members>
        <members>Lists__c</members>
        <members>relationship_owner__c</members>
        <name>CustomObject</name>
    </types>
    <version>42.0</version>
</Package>

User-added image
Alain CabonAlain Cabon
Hi Brooks,

You don't have the correct name (case only perhaps).

In the Workbench, select the menus:  info > Standard & Custom Objects

Do you find all your objects (API name) as exptected in the dropdown list?

Alain
Alain CabonAlain Cabon
The main problem with the workbench is to be wrong with the chosen org (production/sandbox).

It seems that you are logged in the workbench with a new org with different objects.

Under the menu item "utilities" on the workbench, you have your name, just place the mouse over it and you will be sure of the chosen instance (tooltip).
 
Brooks Johnson 6Brooks Johnson 6
My reply from earlier in the day never posted. I was logged into a different Org by mistake.  I found this on the Lists__c object.
 
Influencers on List</label>
        <summaryFilterItems>
            <field>List_Contact_Association__c.Unique_Field__c</field>
            <operation>notEqual</operation>
            <value></value>
        </summaryFilterItems>
        <summaryForeignKey>List_Contact_Association__c.List__c</summaryForeignKey>
        <summaryOperation>count</summaryOperation>


 
Alain CabonAlain Cabon
<summaryForeignKey>List_Contact_Association__c.List__c</summaryForeignKey>
                 <relatedList>List_Contact_Association__c.List__c</relatedList>

Account (analogy): metadata of one field.

<CustomObject> 
<fields> 
    <fullName>MySummaryField__c</fullName> 
    <externalId>false</externalId> 
    <label>MySummaryField</label> 
    <summarizedField>Opportunity.Amount</summarizedField> 
     <summaryForeignKey>Opportunity.AccountId</summaryForeignKey> 
     <summaryOperation>sum</summaryOperation> 
     <type>Summary</type> 
</fields> 
</CustomObject> 

You should have an object : List_Contact_Association__c with a field List__c related to XXXXX.
API Name: List__c     Master-Detail(XXXXX)

The full name is above: ...Influencers on List</label>

And what is XXXXX?
 
Alain CabonAlain Cabon
Logically, the related list into a VFP should be like that:

<apex:page standardController="Lists__c" >
    <apex:relatedList list="List_Contact_Associations__r">
        <apex:facet name="header">Titles can be overriden with facets</apex:facet>
    </apex:relatedList>
</apex:page>

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_quick_start_custom_mapping.htm

( plural and "__r" )
Brooks Johnson 6Brooks Johnson 6
Alain,  I found it in the Schema. The relationship name of the master detail is List_Contact_Associations_del

User-added image
Alain CabonAlain Cabon
Brooks,

In the Visualforce pages and Apex code, the only usable names are the API names (and you find label names, interesting for clues but useless).

For custom objects, look for a pair of entries with the relationship suffix __r:​
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_parent_child.htm

If you want to identify Parent and Child Relationships, there is one (more) technique: the "strongest" when you want to see (almost) "all" the available API names in only one XML file.

Setup > quick search: API > click on Generate Entreprise WSDL > button: Generate just one huge file in the browser with all the API names of your org.

User-added image


<apex:page standardController="Lists__c" >
    <apex:relatedList list="List_Contact_Associations__r">
        <apex:facet name="header">Titles can be overriden with facets</apex:facet>
    </apex:relatedList>
</apex:page>

Do you find List_Contact_Associations__r in the API WSDL ?
Brooks Johnson 6Brooks Johnson 6
Alain, I found the following 
<element name="List_Contact_Associations__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>

I did not find  List_Contact_Associations_dels__r
Alain CabonAlain Cabon
Ok, what is the object that contains this element ? Lists__c ?

<complexType name="Lists__c"> // the name of the complex Type is important.
  <complexContent>
     <extension base="ens:sObject">
       ...
      <element name="List_Contact_Associations__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>
Brooks Johnson 6Brooks Johnson 6
This is what I found
 
<complexType name="Lists__c">
<complexContent>
<extension base="ens:sObject">
<sequence>
<element name="AttachedContentDocuments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="AttachedContentNotes" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Attachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="CombinedAttachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="ConnectionReceived" nillable="true" minOccurs="0" type="ens:PartnerNetworkConnection"/>
<element name="ConnectionReceivedId" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="ConnectionSent" nillable="true" minOccurs="0" type="ens:PartnerNetworkConnection"/>
<element name="ConnectionSentId" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="ContentDocumentLinks" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="CreatedBy" nillable="true" minOccurs="0" type="ens:User"/>
<element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="CreatedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="Description__c" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="DuplicateRecordItems" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Emails" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="EventRelations" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="FeedSubscriptionsForEntity" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="IsDeleted" nillable="true" minOccurs="0" type="xsd:boolean"/>
<element name="LastModifiedBy" nillable="true" minOccurs="0" type="ens:User"/>
<element name="LastModifiedById" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="LastModifiedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="LastReferencedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="LastViewedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="List_Contact_Associations_del__r" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="List_Group__c" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="List_Owner__c" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="List_Owner__r" nillable="true" minOccurs="0" type="ens:relationship_owner__c"/>
<element name="LookedUpFromActivities" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Name" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="Notes" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="NotesAndAttachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Owner" nillable="true" minOccurs="0" type="ens:Name"/>
<element name="OwnerId" nillable="true" minOccurs="0" type="tns:ID"/>
<element name="ProcessInstances" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="ProcessSteps" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="RecordAssociatedGroups" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Region__c" nillable="true" minOccurs="0" type="xsd:string"/>
<element name="SystemModstamp" nillable="true" minOccurs="0" type="xsd:dateTime"/>
<element name="TaskRelations" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="TopicAssignments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
<element name="Total_Influencers_on_List__c" nillable="true" minOccurs="0" type="xsd:double"/>
<element name="UserRecordAccess" nillable="true" minOccurs="0" type="ens:UserRecordAccess"/>
</sequence>
</extension>
</complexContent>
</complexType>

 
Alain CabonAlain Cabon
Ok, it is a mix of what you actually found and the real API names (generated by the Salesforce engine).

1) Create a Visualforce page with the folowing code (example: myVFP )

<apex:page standardController="Lists__c" >
    <apex:relatedList list="List_Contact_Associations_del__r"  />
    <apex:relatedList list="List_Owner__r"  />
</apex:page>

2) Select an item detail of Lists__c in Classics (not in Lightning) with some data in their related lists (in the URL, you will see an ID (ie: 0010Y000005JJqX for an account) at the end of the URL.

3) Just add after salesforce.com and before the Id : https://aaaaaa.salesforce.com/apex/myVFP?id=0010Y000005JJqX
 
Alain CabonAlain Cabon
You can install this powerfull navigator (extension) in Chrome created by Daniel Nakov

https://chrome.google.com/webstore/detail/salesforce-navigator/ecjmdlggbilopfkkhggmgebbmbiklcdo

As soon as it is installed, CTRL + SHIFT + space and type "List".
Alain CabonAlain Cabon

Child Relationship Name +  "__r" = API Name.

Often the Child Relationship Name  is in the plural but that is not mandatory so what you actually found is the exact relationship name (label) and you just need to add "__r" for getting the API Name that is also clearly found into the API WSDL.

The method is finally:

1) Export the metadata of the Layout containing the related list with the workbench
2) Find the related list into the metadata of the Layout

  <relatedList>List_Contact_Association__c.List__c</relatedList>

3) Look at the Child Relationship Name for the field List__c into the object List_Contact_Association__c 
4)  Building the API Name with the Child Relationship Name +  "__r"  
5) Verify the value of the  API Name into the API WSDL.
 
Brooks Johnson 6Brooks Johnson 6
Hi Alain, I was at Boston SF World Tour yesterday. I am just catching up.   If I run the code you posted about with a record ID pasted in I get the message. 

'List_Owner__r' is not a valid child relationship name for entity List.

 If I run it with the  List_Owner__r line removed I get a VF page with the related list. But I try to export it to a CSV I just get those 5 records. 

I am assuming I need to pass the list into a table. 
<apex:page standardController="Lists__c"  contentType="application/vnd.ms-excel">
    <apex:pageBlock title="Influencer List">
    	<apex:pageBlockTable value="{!Lists.List_Contact_Associations__r}" var="list">
    	</apex:pageBlockTable> 
    </apex:pageBlock>                                                                          
    
</apex:page>

This code is giving the error Unknown Property "Lists__cStandardController.Lists"

Have a good weekend. 

 
Alain CabonAlain Cabon
Hi Brooks,

"If I run it with the List_Owner__r line removed I get a VF page with the related list. But I try to export it to a CSV I just get those 5 records" 
but a related list operates like that (short code but also a simplified process).

1) List_Contact_Associations_del__r is what you actually found and it is the exact relationship name (label) + "__r": that works (good point).

<apex:page standardController="Lists__c" >
    <apex:relatedList list="List_Contact_Associations_del__r"  />
</apex:page>

2) The other way is a Visualforce page but you need at least one column.
 
<apex:page standardController="Lists__c">
    <apex:pageBlock title="Influencers">   
        <apex:pageBlockTable value="{!Lists__c.List_Contact_Associations_del__r}"var="mycontact">    
           <apex:column value="{!mycontact.id}" ></apex:column>
           <apex:column value="{!mycontact.Name}" ></apex:column>   
        </apex:pageBlockTable>       
   </apex:pageBlock>
</apex:page>

https://aaaaaa.salesforce.com/apex/myNewVFP?id=< Lists__c Id >
Brooks Johnson 6Brooks Johnson 6
Hi Alain,  I copied your code about in. My need for all this was to be able to export the entire list to Excel with the press of a button. When I run your code about I get the following error. 
Element type "apex:pageblocktable" must be followed by either attribute specifications, ">" or "/>".

But there is clearly an end tag for the at line 7. 

 
Alain CabonAlain Cabon
Hi Brooks,

You should always copy/paste your code (there is a typo perhaps above, missing space before var="mycontact"

<apex:pageBlockTable value="{!Lists__c.List_Contact_Associations_del__r}" var="mycontact">  

In fact, using the relationship directly in the VFP is not the only solution.

We often create VFP + controller.

"to be able to export the entire list to Excel with the press of a button" is just a clone of your existing VFP with the contentType="application/vnd.ms-excel#SalesForceExport.xls" ​

Export data in Excel or PDF format using Visualforce​:
https://help.salesforce.com/articleView?id=000003176&type=1

VFP :
 
<apex:page controller="contactquery" contentType="application/vnd.ms-excel#SalesForceExport.xls" cache="true">
    <apex:pageBlock title="Export Results" >
        <apex:pageBlockTable value="{!cs}" var="contact">
            <apex:column value="{!contact.ID}"/>
            <apex:column value="{!contact.Name}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>



Controller :
public class contactquery{
    public List<Contact> cs{get; set;}
    public contactquery()
    {
    cs = new List<Contact>();
       for (Contact c : [Select id, Name from Contact])
       {       
           cs.add(c);
       }
    }
}

The adapted controller is the problem now for Lists__c.

Alain
Brooks Johnson 6Brooks Johnson 6
Hi Alain, this is still exporting only the first 5 rows in the related list.  How do I fix this? I thought putting it on a table would loop over every name on the list for export. 
Alain CabonAlain Cabon
Hi Brooks,

There are only 5 rows by default.

pageSize Integer The number of records to display by default in the related list. If not specified, this value defaults to 5.

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_relatedList.htm
 
<apex:page standardController="Lists__c" >
    <apex:relatedList  pageSize="100" list="List_Contact_Associations_del__r"  />
</apex:page>
Brooks Johnson 6Brooks Johnson 6
Hi Alain, 

I was busy with some other projects. Hoping I can still get you to take a look at this.  I believe that the maximum number a user can define is 100. What if I want to export a related list with 1000 records? Not sure where that fits in with the page block table.