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
Sandy GaliSandy Gali 

Merging duplicate accounts in Apex - Governor limits

Hi Guys,
              I am trying to find duplicate accounts in the system and trying to merge them based on our filter criteria using apex. The issue is I am hitting the governor limit of 150 DML statements while doing this.
We will have to put the merge statement inside the loop as we need the parent and child as the parameters in the merge statement. I don't think we can bulkify Merge like other DML statements due to the above reason. I am not sure if there is any better way to do it and avoid hitting governor limits.
Any help in this regard would be greatly appreciated.
bk sbk s
Hi Sandy,
  Currently there is a limit on this and there are lot of ideas on this ability as well. As of now i think it could be better to use batch to split records while inserting - only if you have not tried

Thanks 
Bala