I have written trigger for you where I am taking the account name and creating another custom object for deleted account, you can use my code and update the fields accordingly:
trigger copyData on Account (Before delete) {
// Here I am using custom object , you use where you want to copy data
List<Broker__c> lstBroker = new List<Broker__c>();
for(Account acc : trigger.old) {
Broker__c objBroker = new Broker__c();
// I have only used name field for map, you can map what all field you want to map
objBroker.Name = acc.Name;
lstBroker.add(objBroker);
}
if(!lstBroker.isEmpty())
insert lstBroker;
}
I have written trigger for you where I am taking the account name and creating another custom object for deleted account, you can use my code and update the fields accordingly:
trigger copyData on Account (Before delete) {
// Here I am using custom object , you use where you want to copy data
List<Broker__c> lstBroker = new List<Broker__c>();
for(Account acc : trigger.old) {
Broker__c objBroker = new Broker__c();
// I have only used name field for map, you can map what all field you want to map
objBroker.Name = acc.Name;
lstBroker.add(objBroker);
}
if(!lstBroker.isEmpty())
insert lstBroker;
}
I have written trigger for you where I am taking the account name and creating another custom object for deleted account, you can use my code and update the fields accordingly:
Mark my answer as best if it does help you.
Thanks,
Rahul
All Answers
I have written trigger for you where I am taking the account name and creating another custom object for deleted account, you can use my code and update the fields accordingly:
Mark my answer as best if it does help you.
Thanks,
Rahul