After a record is updated I need to make a callout to an external api.

At the moment I have invocable apex being called from process builder, which is calling a furture method with callout=true.

This works fine for small numbers of records, but when more than 50 records are updated, it hits salesforce limits on the number of concurrent future methods and fails.

How can I call external api on update of record without it failing for large numbers of records?

  • I think you will have to replace the process builder with a trigger and change your callout method so it can handle a list of primitives (if you stay with future) or a list of objects (if you go with a Queueable interface). – David Cheng Sep 5 '19 at 14:50
  • 1 future method can make multiple callouts – cropredy Sep 5 '19 at 17:42

I am not sure if it is the best approach, but I had a situation very close of that where i need to post data to 3rd party system from Salesforce. I have scheduled a job for every 1 hour and calling batch apex where we were getting all records modified in last 1 hour and posting data to 3rd party in single callout with limiting batch size as per our requirement.

As per your requirement you can change job every 15 mins and job size.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.