2

Is there any OOTB way of having a Primary Contact for an Account?

One idea is to create a custom lookup field for Primary Contact on Account object. However, it will need validation such as the selected primary Contact's Account should match the currently viewing Account. (I do not want to use a Lookup Filter because users can click Show All Records.)

  1. Will I need to utilize AccountContactRole for my requirement? If yes, how should I implement this junction object to fulfil my requirement?
  2. Or should I go with my Lookup field with a Validation Rule?

2 Answers 2

5

Any special reason why you need a custom lookup field on Account? That's what AccountContactRole object is for (as you mentioned in the question).

It's a junction object though (has 2 masters) which means you can't make a lookup to it (similar to OpportunityContactRoles, OpportunityLineItems etc).

If you need it really as lookup (to use in some formulas I guess?) consider filling it in with a trigger or something (based on Contact Roles), not letting users pick it. Filtered lookups are bit annoying for users as they'd need to know what to type in the search or view the Contact before using the lookup (so it appears on their "Recently viewed" in the lookup window).


Here's the out of the box functionality (sample data found in any Developer Edition):

Sample Contact Roles

  1. Not all Contacts need to have a Role. Contact can have more than 1 Role. Only one can have "Primary" ticked (if you set it, SF will automatically remove it for you from all others, even if you'll try to cheat with a mass update from Apex or Data Loader for example).

  2. Contacts that aren't related to this company can be selected too (imagine a company that has HQ office, a branch office and common accounting department - you could use person from HQ Accounting as a Role in the child company).

  3. You can modify the Roles picklist in the setup. You can't add fields to the object or make lookups to it. As far as I know there's no "magic" happening when you make an Opportunity (if you'd want to automatically copy this data to Opportunity Contact Roles you'd need a trigger. But since each Opp should be unique and could have different key stakeholders maybe it's good).

I think that's pretty much it, check help for more? Not sure what more "out of the box" you'd want that would be generic enough to work OK for all businesses...

Last but not least - Entity Relationship Diagram :)

3
  • No, I do not need the custom lookup field on Account. That was just an idea which I though of, to implement Primary Contact functionality. Sorry about the confusion, I have edited my question to mention that it is just an idea. However, I could not understand how to utilize the AccountContactRole junction object to implement Primary Contact for Account. Will it be possible for you to give a small explanation about the same, by editing your answer or perhaps in the comments of your answer? Thank you in advance. Mar 21, 2013 at 10:30
  • Thank you for your time and meticulously detailed answer, for helping me and the community. I see that you have almost hit 6,000 points! Mar 21, 2013 at 19:30
  • 1
    @SumanKrishnaSaha No problem :) Glad I could help! I enjoy answering although this particular one wasn't too much of a challenge ;) And I've also learned few tricks myself, some guys over here really rock. Speaking of which, why you keep changing names :D
    – eyescream
    Mar 21, 2013 at 19:49
3

Edit: You changed your question, and i'm going with eyescream here, Contact Roles are the best method to go with, instead of using a lookup filter.

For future reference, here is the answer on the lookup filter question:

Change your Lookup filter, to set the Account of the contact, equal to that of the current account. Put the filter on required, that way, they won't be able to select Show All Records, and only the contacts of the current account will be shown.

enter image description here

1
  • Thank you for your time and your answer. This has helped. Mar 21, 2013 at 19:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .