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
Varun TejaVarun Teja 

Create Batch Apex on Account, contact ,Opportunity and case

Create Batch Apex on Account, contact ,Opportunity and case

1.First we have to create One ArchivalTable as a new Object,in that object creating new fields as Date,AcctId,Number Of Contacts Count,Number Of Oppt Count,Number Of Cases Count.
2.Create same fields (Number Of Contacts Count,Number Of Oppt Count,Number Of Cases Count) to know the total how many records have been deleted for Account.
3.Lookup ArchivalTable object with Account Object
4.We have to delete last 7 days records from contact,Opportunity and cases.This job should be done every 7days once.
5.We have to capture how many records have been deleted and insert those details into ArchivalTable object.Same Total number of count deleted to respective Account. 

Thanks in Advance