You need to sign in to do that
Don't have an account?
Dippan Patel 3
Apex Trigger to undelete the contact
Hi All,
I have two contacts: Contact A and Contact B which are duplicates. Contact B has Custom Related Object (CRO) C. When Contact B is merged with Contact A, CRO C is moved to Contact A. Contact B is deleted. Instead of immediately deleting Contact B, I want to merge the two records, (moving CRO C to Contact A) and update values of Contact A. However, I want Contact B to remain.
I want to write an apex trigger that can bring this deleted contact back or triggers any event that doesn't delete the Contact B. Or is there any other solution for this?
I have two contacts: Contact A and Contact B which are duplicates. Contact B has Custom Related Object (CRO) C. When Contact B is merged with Contact A, CRO C is moved to Contact A. Contact B is deleted. Instead of immediately deleting Contact B, I want to merge the two records, (moving CRO C to Contact A) and update values of Contact A. However, I want Contact B to remain.
I want to write an apex trigger that can bring this deleted contact back or triggers any event that doesn't delete the Contact B. Or is there any other solution for this?
One solution that cross my mind is you can create a before delete trigger on Contact.
Before deleting the record create a new record with same values.
Hope this helps.