You need to sign in to do that
Don't have an account?
vicky30
Apex trigger to delete contacts when account is changed
Hi Friends,
I have one custom object called "call" and this object is child to account object.
When we click on new button on call object, it will redirect to VF page, In that page we have Account lookup field, and we have section called Attendee(Contact user), The attendee are related to that account.
My requirement is when we update the account with different account name, Then the old account related attendee should be delete.
I want the trigger logic. Could any please help me on this.
Please find the screenshot for reference.
Thanks in Advance,
vivek
I have one custom object called "call" and this object is child to account object.
When we click on new button on call object, it will redirect to VF page, In that page we have Account lookup field, and we have section called Attendee(Contact user), The attendee are related to that account.
My requirement is when we update the account with different account name, Then the old account related attendee should be delete.
I want the trigger logic. Could any please help me on this.
Please find the screenshot for reference.
Thanks in Advance,
vivek
Hi Vivek
if you found this answer helpful then please mark it as best answer so it can help others.
Thanks
Akshay
Considering your requirements:
Like While updating your existing account with different Name, then related contacts should be deleted.
Note: "Attendee" considering as "Contact". If it is other object change the Object API name in SELECT statement(in SOQL present in below code).
If it helps you, Mark it your answer to help others.
Thanks
Niraj