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
Naresh123Naresh123 

How to display Contact and related Account in VFP.?

Hi Friends,

                      I want to create Visualforce page that when given a contact ID will display that contact, the account that it is associated to, as well as the billing addresses of each (which should be the same).  Can anyone help me out to write this..........Thanks in advance

Ispita_NavatarIspita_Navatar

Hi Naresh,

Try the following code snippet to achieve your requirement:-

 

<apex:detail >
Tag like this:
<apex:page standardController="Contact">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You belong to the {!contact.firstname}.  
</apex:pageBlock>  
<apex:detail subject="{!contact}" relatedList="false"/>  <apex:relatedList list="OpenActivities" subject="!$CurrentPage.parameters.relatedId}"  />
</apex:page>

 Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

Naresh123Naresh123

Hi Ispita Saha,

                    First of all thanks for spending your valuable time.Here i am getting error like Formula expression is required for attribute subject in <apex:relatedList>.

Ispita_NavatarIspita_Navatar

Hi,

 

Please try this

 

<apex:page standardController="Contact">

 <apex:pageBlock title="Hello {!$User.FirstName}!">

     You belong to the {!contact.firstname}.

 </apex:pageBlock>

 <apex:detail subject="{!contact}" relatedList="false"/>

 <apex:relatedList list="OpenActivities" subject="{!$CurrentPage.parameters.relatedId}"  />

</apex:page>