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
aaryansriaaryansri 

How to fetch the Account Name By selecting contact Name in custom object( communications__c) ?

I have a 2 fields in Communication__c (Custom object).
field 1: Select_Contact__c (Lookup) (from Contact Object)
field 2: Account_Name__c (Text).
In VisualForce Page, when ever user selects the contact from lookup , automatically fetch the Related Account name...and Displayed in Account_Name__C (Apex: OutputText)
How to achieve this by using SOQL Query.
ShotShot
Do you want to get Account Name from standard object Contact? 
SELECT Contact.Account.Name FROM Contact WHERE Id=:someId