+ Start a Discussion

Accessing Contact and associated Account address from a web tab

Create a simple Visualforce page that when given a contact ID will display that contact, the account that it is associated to, as well as the billing address of account and other address of contact . Want to make this  Visualforce page accessible via a Web Tab.


How can I do this. Any help would be greatly appreciated

On a "Web Tab" you don't have context of what Contact record you want to display this information for. This is a simple Visual force page wherein you can query the Contact and related account and account's attributes and display it. The SOQL in your controller would look like:


select Name,Account.MailingStreet,Account.MailingCity from Contact where Id=:idParam

 The visual force page would look like:


<apex:page standardController="Contact"><apex:outputText value="{!Contact.Name}"/><apex:outputText value="{!Contact.Account.MailingStreet}"/><apex:outputText value="{!Contact.Account.MailingCity}"/></apex:page>

 If that does'nt work, use a controller extension, fetch the data via the SOQL and display it in your page.






Thanks for your early response.


I am a newbie to VF could you please eloborate on this.I am having a tough time coming up with this page.


Once again thanks much.