I don't understand the difference between:

@future (callout= true)


@future (callout= false)

I have read the documentation, but I don't understand where to use one or the other.


If you want to call third party system or any http call outside of salesforce system you need to set callout=true in the future method. If you set it to false it means the method is not making any http callout.

By default its false to there is no need to mention callout= false

  • And are there any reason to do it? Why do you have to specify it? – David Marciel Apr 13 '17 at 14:43
  • so like i said if you want to call any external system or any third party services like google map or autocomplete you make a http call to the third party system. if you dont say callout=true it means the future method cannot call the external system. by explicitly using this annotation you are basically saying this method is allowed to make http callouts and will do a callout to implement some functionality – RedDevil Apr 13 '17 at 14:47

The document you linked and the annotation itself both seem quite clear:

To allow callouts in a future method, specify (callout=true). The default is (callout=false), which prevents a method from making callouts.

The following snippet shows how to specify that a method executes a callout:

@future (callout=true)
public static void doCalloutFromFuture() {
    //Add code to perform callout

That's just how the language was designed. By default future methods cannot make callouts. It's pretty similar to other asynchronous jobs in forcing you to specify when they interact with external systems.

Using Callouts in Batch Apex

To use a callout in batch Apex, specify Database.AllowsCallouts in the class definition. For example:

global class SearchAndReplace implements Database.Batchable<sObject>,

Callouts include HTTP requests and methods defined with the webService keyword.

As a consequence of the above, you can determine at compile time (just based on the SymbolTable, for example) which asynchronous methods are strictly internal, versus those that can interact with other systems.

  • I have already chosen another answer as correct, but yours are also good, thanks. – David Marciel Apr 13 '17 at 15:17

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.