3

Some days ago I imported a WSDL into Salesforce and (different of some years ago) it created an Async class (and of course the sync class). So I decided to search on Google how to use this Async class. I've found some articles about that and I implemented this solution for test... For my surprise, the Async class can't be called inside a trigger. Now I'm asking myself and now asking you all: What's difference between of using this Async class and use @future method (and use Sync class)?

1 Answer 1

6

The Async class is intended to be used in a continuation. See Make Long-Running Callouts from a Visualforce Page

enter image description here

Basically, a continuation will provide a callback mechanism so that when the async callout is complete you can bring the result back to the client.

A @future method won't provide that callback mechanism. It's more fire and forget.

2
  • But on trigger context (that you can't wait for an awnser), are @future method and Async class equals? Commented May 1, 2016 at 23:45
  • You can only* use the async Continuation classes from a Visualforce context. They don't work anywhere else. Plus a trigger isn't going to wait around for the callback to occur before it can finish. Triggers need to be as fast as possible. Commented May 1, 2016 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .