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
Vinothkumar M 1Vinothkumar M 1 

SF developer

HI all,

Account which don’t have opty for more than 2 years, all need to move to Lead.

please help with write batch apex

Any one please suggest 
Abdul KhatriAbdul Khatri
Hi Vinothkumar,

I guess moving to Lead means, create a lead for those Accounts. I guess we also need to take into Contact for that Account for the FirstName and LastName on the Lead.
  • Do you know what data you need to pull and from where to create a Lead?
  • What happened to the Account and Contact after creating a lead?
    • Should we delete them or?
    • Should we tag them with something so the system should not keep creating the lead or?
    • Should there be an identifier on the lead from Account or Contact like Email etc. to check if the lead for the Account or Contact already exists?
  • 2 years I guess to check from the Account CreatedDate?
If you can clarify these questions or any further details you can provide.
Vinothkumar M 1Vinothkumar M 1
Hi khatri, I already moved my old account without opty to lead. batch apex for future to automatically move to lead without manual intervention. I am not aware of the code for salesforce. Thanks, Vinoth M