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
SFDHSFDH 

how to display contact of Selected account ?

hi ..

 

 How to create 2 lookup fields in Visualforce page

  • 1st lookup field for Account
  • 2nd Looup field for contact

first i will select the acoount from the 1st lookup and then when i sselect the 2nd lookup field it should display the Contacts associated with the account i have selected from the first lookup ...

 

Help ....

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Dhaval PanchalDhaval Panchal

I have different idea.

1. Create one lookup for account (i.e. Other_Account__c)
2. Create one lookup for Contact (i.e. Contact__c)
3. Add lookup filter on Contact__c as below

Contacts of other Account: Account Name ID equals Contact: Other Account ID

Now contact lookup will display contacts based on selected other account.

All Answers

Dhaval PanchalDhaval Panchal
Not able to understand exact requirement. Please give some more detail with example.
SFDHSFDH

Thanks for the Reply

 

HOw to create 2 Looup fields link to eachother in a way that

 

When i select a Account from the 1st Lookup field

 

the Second lookup should display the related contact to the Account that is selected in the First lookup field .

Dhaval PanchalDhaval Panchal
Ok, But I have one more question. Account may have more than one contacts, and you want one lookup for contact then how it is possible?
Dhaval PanchalDhaval Panchal
You can create related list for selected account.
SFDHSFDH

Sorry ididnt mention this ...

 

I want to Create it in Visualforce page ...

Dhaval PanchalDhaval Panchal

I have different idea.

1. Create one lookup for account (i.e. Other_Account__c)
2. Create one lookup for Contact (i.e. Contact__c)
3. Add lookup filter on Contact__c as below

Contacts of other Account: Account Name ID equals Contact: Other Account ID

Now contact lookup will display contacts based on selected other account.

This was selected as the best answer