You need to sign in to do that
Don't have an account?
sites1.3909952495827087E12
future method cannot be called from a future or batch method salesforce
I Hav one batch class on Accoun running every hour. and on account object one more trigger calling the @future method in class.
wen i run te batch iam getting this error. How to avoid thsi error.
wen i run te batch iam getting this error. How to avoid thsi error.
There is a salesforce limitation that you can not call future methods from batch. To avoid this error you can keep one flag in batch class and check that flag in Account trigger, if it is coming from batch do not call that future method.
Batch class
public static accountBatchFlag = false
Before performing any updates/inserts you can make this flag as true in batch
In trigger you can check the condition if accountBatchFlag is false then call future method. this way you can avoid error
All Answers
There is a salesforce limitation that you can not call future methods from batch. To avoid this error you can keep one flag in batch class and check that flag in Account trigger, if it is coming from batch do not call that future method.
Batch class
public static accountBatchFlag = false
Before performing any updates/inserts you can make this flag as true in batch
In trigger you can check the condition if accountBatchFlag is false then call future method. this way you can avoid error