You need to sign in to do that
Don't have an account?
RRK
Primary Contact on Account
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.
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.
Because need contact Id for update on Account. so, workflow cannot do that