Future Method calling Another Future Method

I have two future methods f1 & f2.

Each of them takes long time to process as such I have annotated them as @future.

There is a scenario in which I need to make a callout to f2 from f1.

Any workarounds to achieve this ?.

Answer

You cannot call another future method from a future method. As per Salesforce documentation,

You cannot call a method annotated with future from a method that also
has the future annotation. Nor can you call a trigger from an
annotated method that calls another annotated method.

If you do not have dependency between f1 & f2, you can call both methods one by one from original class.

Attribution
Source : Link , Question Author : Iamauselessrightbrainer , Answer Author : Victor

Leave a Comment