function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Cannot run my Batch apex as it invokes a future method


Iam new to apex and managed to write a batch apex class. We have an object <object1> and we have a trigger on 'after update' event on that object. This trigger invoke one @future method.

In my batch apex Iam updating a field on <object1> and calling the update operation on that object. I get a system exception "System.AsyncException: Future method cannot be called from a future method:". I read through various posting and found that we cannot invoke a future method from the batch apex because of the async behavior.

I cannot remove the @future from my trigger, is there any way I can get this to work? If batch apex is not the route to be taken, what would be my other alternative to schedule a apex class to update the field on the object.

I appreciate your help



Have a boolean static variable and set the value to true in the batch apex class. In your trigger call the batch apex only if the static boolean variable value is false.


Thanks for your response, I thought about that option, but unfortunately I cannot alter the code in 'after update' event on the object as it is the Out of box code form a vendor, we are instructed not to touch that code, so Iam stuck with that option.