• Cong NguyenManh
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi can someone help me in writing a trigger for the below scenario as i'm new for coding and do not have much  experience in writing trigers

When a Contact is updated and Primary checkbox is set, that contact will become the primary contact and the reference should get updated on Parent Account. The Primary Contact flag should be true for only one contact at a time. If an Account has no Contacts, then the first created contact by default becomes the primary and that value should be set in reference. If the primary contact is deleted, the next available contact, if there is any, should be the primary contact and the relationship on account should reflect this. If all contacts are deleted, the primary contact reference on Account will be Blanked out. Test Class as well for it.
  • February 06, 2015
  • Like
  • 0