1

I am creating an account Trigger with

the following conditions:

IF: is not a batch request and is not a @future request we invoke a @future callout for each time the triggers fires. ELSE:

we invoke a class that implements "queueable" which invokes a future callout with a List

So, sometimes there is an error that says that we are making more than 101 callouts, I believe that someone in this ORG where our APP is installed is updating the account object masivelly not using batch process.

I am not sure how to deal with that scenario.

  • 1
    It sounds to me like there are some red flags in the architecture of the code you're describing. There isn't much that I (or anyone else) can do if you don't provide the code that you're having trouble with, though. It would also be helpful to know what you're using an @future method for, and why you're trying to use queuable to try to 'chain' @future calls. – Derek F Jan 25 '17 at 14:24
  • I agree, if you are having problems with someone batch updating, then that's a sign that your code isn't properly bulkified. You should always assume an update size of up to 200. Perhaps you can add a check if your queued job for the list size and do 2 future calls? Overall, though it sounds like you need to reevaluate the design choices made. – brezotom Jan 25 '17 at 15:38
1

I think you need to use a Batch and when the trigger is fire you execute 90 batch per time, somethin like that

trigger SendDonorData on Contact (after insert, after update) {

        SendDonorBatch sdb = new SendDonorBatch(trigger.new);
        id batch = DataBase.executeBatch(sdb,90);
}

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.