How to control the order in a future callouts for the same object. In the Account object I need to make two call outs inafter insert trigger. Now being future notation my second call out is getting fired first and then the first call out. But I need the other way ....Any ideas?

I have two if loops from where based on the conditions specified the callout is made.

  • 1
    why not rearchitect the trigger/future to pass a map of id | list of callout actions and let single future method sequence appropriately?
    – cropredy
    Feb 27, 2015 at 18:30

1 Answer 1


You can't control the precise order of execution across multiple asynchronous calls. That's the nature of asynchronous calls. Perform both calls in the same asynchronous function if you need a specific order. Also, the Queueable interface may provide the ordering you need, since each successive call to System.enqueueJob will schedule each successive call further in the future than the call before it (see the documentation for details), but you'll need to do some heavy duty testing.

  • 1
    Even then it is not a guarantee that two Queueable calls will get executed in the order scheduled. The reliable way to do this, make two calls out in one future/Queueable job or use Queueable job chaining. At the end of First call out job, enque second job. Feb 27, 2015 at 21:14

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.