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
nununinununi 

Related Lists not appearing on VF page with Custom Controller

I have built a VF page to show a bunch of account fields. The record id is pulled from the logged in user details. The fields all work fine and the page shows the correct record. Now, I need to show a few related lists at the bottom. The apex code for the bottom part is:
<apex:pageBlock title="Previous Contracts">
     <apex:relatedList list="Contract_Vehicles__r" subject="{!$CurrentPage.parameters.Id}" id="ContractVehicles">
     </apex:relatedList>
     <apex:relatedList list="Previous_Federal_Contracts__r" subject="{!$CurrentPage.parameters.Id}" id="FedContracts">
     </apex:relatedList>
     <apex:relatedList list="SEC_Contracts1__r" subject="{!$CurrentPage.parameters.Id}" id="SECContracts">
     </apex:relatedList>
     </apex:pageBlock>
     <apex:relatedList list="Contacts" subject="{!$CurrentPage.parameters.Id}" id="Contact" >     
     </apex:relatedList>
     <apex:relatedList list="Company_Documents__r" subject="{!$CurrentPage.parameters.Id}" id="CompDocs">
     </apex:relatedList>

And my controller is as follows:
public class myAccountController{

    public Account Account{get; set;}
    public List<Contact> Contact{get; set;}

    public myAccountController() {
        
        String uid = UserInfo.getUserId();
        String Accid = [SELECT accountid FROM User WHERE id =: uid LIMIT 1].accountid;
        if(Accid != NULL){
        Account = [SELECT Id, Name, Fax, Phone, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingAddress, ShippingCountry, Website,
                                 Agencies__c, Annual_Revenue__c, Business_Classification__c, 
                                 Contract__c, Contract_Number1__c, Contract_Number_2__c, Contract_Number_3__c,
                                 Contract_Number_4__c, Contract_Number_5__c, Contract_Vehicles__c, COR_Names__c,
                                 Dates_O__c, EIN__c, Intake_Question__c, Legal_Entity_Type__c, 
                                 MWOB_Status__c, NAICS_Code_Only__c, NAICS_Code__c, No_of_Employees__c, POC_First_Name__c,
                                 POC_Last_Name__c, Previous_Federal_Contracts__c, Previous_SEC_Contracts__c, SAM_Registry__c,
                                 SEC_Contract__c, Secondary_NAICS_Code__c, Year_Established__c, DUNS_Number__c    
                                 FROM Account WHERE Id =: Accid LIMIT 1];
                                 
        Contact = [SELECT id, Name, Email, Phone, Title FROM CONTACT where Accountid = : Accid];
                                 
        
        }
    }

    
    
    
    public PageReference save() {
        update Account ;
        return null;
    }
}

The related lists are not appearing on the page. Can someone please let me know what modification I need to make to the controller? 
Jerome LusinchiJerome Lusinchi
Hi nununi,

in order to use the <apex:relatedList> tag, first you need to use the standard controller of your object.

Jerome