New answers tagged


One what to do this is with continuations. It's a callback mechanism that is built into Visualforce. See Make Long-Running Callouts from a Visualforce Page. You can also use them from Lightning - Invoking Apex Continuations from Lightning Components. Or a more official version from Summer '19 - Make Long-Running Callouts with Continuations.


It should be as simple as using a Queueable with Database.AllowsCallouts instead of using a future method. See the product documentation for details. There are lots of alternatives you could consider in terms of the over-all approach, such as generating platform events with the JSON (as text) in them, but this approach does keep it clean and simple.


No, it is not technically possible. Synchronous callouts in Triggers are not allowed. There is an Idea to have Salesforce do this, but it's already a decade old, and may never be implemented. The main concern about callouts during triggers is that it will significantly increase database contention, which may cause deadlocks as the database has to hold record ...


Got it to work using the password response type as follow : public with sharing class AP_SandboxRefreshInitSetup { String username; String password; String accesstoken ; String instanceURL ; String clientId; String clientSecret; public AP_SandboxRefreshInitSetup(string username, ...


response_type=code is an authorization grant type (flow) in oAuth, it involves a redirect with an authorization code which you then exchange for an access token (see docs). You're expecting an access token to come back right away, this is not the flow that does this. For service-to-service calls, JWT Bearer flow is the recommended option. If both sender and ...

Top 50 recent answers are included