Skip to main content
added 745 characters in body
Source Link
Boris Bachovski
  • 16.3k
  • 8
  • 50
  • 88

No, you can call up to 10 subsequent future calls from 1 single transaction (apex invocation from a class/trigger/webservice), although you can't call a future method within a future method. So you can't have a trigger for an example that will call some future method, and inside that method calling another future method.

I guess in your case you're trying to do another future callout from within the method that is already annotated as @future and it's being called from another class/trigger?

Here you can find more information around the governor limits, and also the Limits class which you can utilise to get the number of methods with the future annotation that have been executed (Limits.getFutureCalls())

UPDATE:

Based on the updated question, you've got a @future method that does an update of an account, which triggers another @future call within the trigger on account update. This causes a 2nd @future call to be made within the same context. What you need to do is to prevent the trigger on account from firing when you're updating the account record from your google API @future method. You can do that by creating a static boolean variable that you will set to true in your class, and then inside the trigger you will check against that variable - execute the trigger only if this variable is set to false (which will be the default value at all times, except for your google API @future method where you're going to set it to true).

No, you can call up to 10 subsequent future calls from 1 single transaction (apex invocation from a class/trigger/webservice), although you can't call a future method within a future method. So you can't have a trigger for an example that will call some future method, and inside that method calling another future method.

I guess in your case you're trying to do another future callout from within the method that is already annotated as @future and it's being called from another class/trigger?

Here you can find more information around the governor limits, and also the Limits class which you can utilise to get the number of methods with the future annotation that have been executed (Limits.getFutureCalls())

No, you can call up to 10 subsequent future calls from 1 single transaction (apex invocation from a class/trigger/webservice), although you can't call a future method within a future method. So you can't have a trigger for an example that will call some future method, and inside that method calling another future method.

I guess in your case you're trying to do another future callout from within the method that is already annotated as @future and it's being called from another class/trigger?

Here you can find more information around the governor limits, and also the Limits class which you can utilise to get the number of methods with the future annotation that have been executed (Limits.getFutureCalls())

UPDATE:

Based on the updated question, you've got a @future method that does an update of an account, which triggers another @future call within the trigger on account update. This causes a 2nd @future call to be made within the same context. What you need to do is to prevent the trigger on account from firing when you're updating the account record from your google API @future method. You can do that by creating a static boolean variable that you will set to true in your class, and then inside the trigger you will check against that variable - execute the trigger only if this variable is set to false (which will be the default value at all times, except for your google API @future method where you're going to set it to true).

Source Link
Boris Bachovski
  • 16.3k
  • 8
  • 50
  • 88

No, you can call up to 10 subsequent future calls from 1 single transaction (apex invocation from a class/trigger/webservice), although you can't call a future method within a future method. So you can't have a trigger for an example that will call some future method, and inside that method calling another future method.

I guess in your case you're trying to do another future callout from within the method that is already annotated as @future and it's being called from another class/trigger?

Here you can find more information around the governor limits, and also the Limits class which you can utilise to get the number of methods with the future annotation that have been executed (Limits.getFutureCalls())