• Deepak Kemidi 5
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hey Guys, I have a requirement where I have to bulk insert around 3000 records into a table every Saturday. This will be done using a batch job. After insertion, I have to update the Rank fields of the records based on a Revenue field while grouping it by Region and Team.
The logic is pretty simple, create a list of all the records, order by revenue DESC, loop through the list and use the index as the ranking.

However, I'm hung up on doing this at a large scale. It can't be done through a trigger since it gives me a 10,001 DML error. I've tried Apex Batch Update, but that seems to only load 200 records at a time before applying the above logic. However, I need to run the logic on all the records at once. I'm not very familiar with Batch Apex so maybe there is a different way to load the data.

How can this be done? Thankyou.