You need to sign in to do that
Don't have an account?
Yelper Dev
Primary Contact - Contact Trigger Handler
Hello, Can anyone help me with the following requirements? The even of the trigger is before Insert.
[1] If there is no contact records on the Account, the new contact record should be automatically be the primary contact (Checkbox field)
[2] If 2 Account has no contact records, the 2 new contact records should be automatically be the primary contact.
[3] If the Account has already a contact record that is already a Primary, it should prompt an error message "Already has primary contact"
Contact Trigger:
[1] If there is no contact records on the Account, the new contact record should be automatically be the primary contact (Checkbox field)
[2] If 2 Account has no contact records, the 2 new contact records should be automatically be the primary contact.
[3] If the Account has already a contact record that is already a Primary, it should prompt an error message "Already has primary contact"
Contact Trigger:
trigger ContactTrigger on Contact (before insert, before update) { if(Trigger.isBefore){ if(Trigger.isInsert){ ContactTriggerHandler.doBeforeInsert(Trigger.new); } if(Trigger.isUpdate){ ContactTriggerHandler.onBeforeUpdate(Trigger.new, Trigger.oldMap); } } }Thank you.
This might help you. https://developer.salesforce.com/forums/?id=906F0000000kKRYIA2