You need to sign in to do that
Don't have an account?
Rick Tyler
Delete Contact but update Account record
Hello,
I need help with a deleing Contacts from an Account and updating the Account. If I have multiple Contacts on an Account and one of the Contacts is checked as the primary then the checkbox on the Account should be checked. If a contact is deleted I need to detemine if it was the Primary. So if a non primary Contact is deleted then the checkbox on the Account remains checked. But if the Contact that is flagged as the primary is deleted then i need checkbox on teh Account to be unchecked.
Thanks
I need help with a deleing Contacts from an Account and updating the Account. If I have multiple Contacts on an Account and one of the Contacts is checked as the primary then the checkbox on the Account should be checked. If a contact is deleted I need to detemine if it was the Primary. So if a non primary Contact is deleted then the checkbox on the Account remains checked. But if the Contact that is flagged as the primary is deleted then i need checkbox on teh Account to be unchecked.
Thanks
Thanks for the reply. I assumed as much but the issue with the code. I think I can figure out a way to delete a contact but checking the remaining Contacts to see if there is a Primary is where I am getting hung up.
Thanks
R
It is quite easy with a Trigger. Here you will need to fire a SOQL where you will get all the contacts for that particular account, now check the number of contacts having the checkbox Primary Contact. If only one contact is having that checkbox, and that particular contact you are to delete. Then update the account, otherwise there is no need.
Do you got my point? If there is any confusion do reply, so that i can help you in a better way.
Regards,
Somya Tiwari
Thanks for the reply. I have seen trigger examples but
I a trying to get this done in a class so that I just have a
a single trigger for the account object. If you could get me
started that would be great.
cheers
R