• Devon Allary
  • 0 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0
Our company uses a project management tool to manage engagements after they've been won in Salesforce. I've set up an Apex callout that will request the status and other information on the engagement from the project management tool's API and will use that status to update Salesforce.

Each of the engagements needs its own separate API call. We might, at any given time, have thousands of open engagements and I need to update these every night.

I've set up a scheduable Apex class that runs a query to find all of the open engagements that are connected to the project management tool. Then, I just loop through the records and for each one I run the API call and update. This seemed to work in the testing phase, but now I have many more records and I'm getting a "Too many future calls: " error.

I was thinking about running a scheduled query beforehand and dividing all of the Salesforce engagements into groups of 50, then scheduling multiple updates of 50 records staggered by a couple of minutes. This doesn't seem like a very scalable, though. Does anyone know of a better way to do this?