I have actually a batch on user, where user are activated or deactivated based on a criteria. In each execute I update my set of users, which in turn launch an @future method to recalculate the role for each user. The method need to be @future and is executed on trigger for user after update. The problem is that this generate the following error :
System.AsyncException: Future method cannot be called from a future or batch method:
I understood that as each execute is considered as a future call, I cannot execute another future from my trigger in each batch execute. So i decided to update all my users in my finish, which will call my future method, but now I am obtaining the following error :
System.LimitException: Too many future calls: 1
Does this mean that will not be able to execute a future method from a batch ??? If not, then how can I achieve this?
This is not a duplicate of Calling future method from batch class?, because there it is doing callouts whereas in my case, I am recuring to @future because in a user trigger i cannot do any other DML. Also their hasn't been any best answer marked there.