function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vinni1vinni1 

URJ: Deleted contact records capture into another object

Hi All,

 

I have 3 objects account,contact and DummyContact . account and cotact have Master detail relation ship..

 My Req is capure the deleted contact records under Account  in to DumayContact object

 

 

please help for this

 

trigger DuplicateContact on Contact (after delete)
{
set<id> allacc = new set<id>();
for(contact allcon:trigger.old)
{
allacc.add(allcon.id);
system.debug('old====>'+allacc);
}
list<contact> allconss = [select id,name,accountid from contact where accountid=:allacc];

Bhawani SharmaBhawani Sharma
YOu just need to create new list of Dummy Contact and associate it with Account.
List<DummyObject__c> dummyContacts = new List<DummyObject__c>();

for(Contact c : Trigger.Old) {

dummyContacts.add(new DummyContact__c(Account__c = c.AccountId));
}