2

I'm trying to make a new section in Related List under Accounts, like how the default contact section displays in Accounts, except I need it to display Contacts from the branches. We currently have Company->Location->Contacts for structure. Where each Location has their own contacts and the Company groups those locations together for each customer's branches.

So far I've only been able to use classes and visualforce to create a small section with all the contacts for that company, but it would be better if it could look something like the Related List Contacts. I have tried using custom objects, but I can't seem to find a way to make it just "grab" data from other objects. Is this possible in salesforce?

Thanks,

  • Company is an Account right? – Keith C Jun 26 '14 at 18:52
  • yes, so its Account->Account->Contacts – Nataku Jun 26 '14 at 18:59
1

If you add a lookup from Contact to Account called "Company" and use triggers (on Contact for inserts and updates and on Account for updates and deletes) to keep that set to the root Company Account, then you should be able to show all the Contacts via that association in a normal Account layout. (Assuming you aren't using a record type to differentiate between Company and Location the list would appear for both but would be empty for the latter.)

  • it works! Thanks :) (still not very good at coding these triggers so it took me a while) – Nataku Jun 26 '14 at 20:12
  • @Nataku Hey about an hour - seems pretty good to me. – Keith C Jun 26 '14 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.