• sudharani2561.3929872187343342E12
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

I have a requirement from a client that states the following:

 

In a salesforce.com environment, the client wants to ensure the following:


● Each account may have multiple contacts but only one marked “Primary”
● Each account must have 1 primary contact.
● The account should display the name of its primary contact on the account detail screen (i.e. in a field).

 

How do I start this requirement I am thinking of doing the following:

 

Creating trigger on the Account object (after update, after create) that will run thru  the list of related contacts to make sure atleast one is created with Primary checkbox field is marked true.

 

Also create a Contact Trigger (before update, before create)  that will:

 

Find current Primary contact for the Account.

                   If current contact is primary do nothing

                   If current contact is new Primary.  Update old Contact Primary check box to False.  Update current Contact to True.

                                     And Update Primary Contact Name field on Account record with primary contact name

 

 

 

Does this make sense?