I need to make 5 callouts serially. I have written 5 different apex classes. I want to chain these callouts from JavaScript controller using Async/Await or Promises. Had anyone worked on such scenario? Any problems or blockers? Each call is taking few seconds – so no timeout issue. I am logging each callout results, so I might get uncommitted work pending exception. Please suggest
Apex Callouts – Chaining from JavaScript Controller Using Async/Await or Promise
apexcalloutlightning-web-components
Best Answer
There's no concern there. As long as each callout occurs before the DML in each Apex transaction, you'll be fine. For example, you can write your logic like this:
Each result will have been obtained from a separate transaction that each had their own separate governor limits.