+ Start a Discussion
SandrineSandrine 

Error System.AsyncException

Hello,

I get below error when executing trigger
System.AsyncException: Future method cannot be called from a future or batch method:
My code is something like below:
trigger triggername on custom__c (after update, after insert) {

                Call.calculate('abc');	

    
}

global class Call {
    @Future(callout=true)
    Public static void calculate(String value)
    {
       //Do something
    }
}

how will i be able to resolve it, making sure that the the code is exeuted alteast once.
 
Best Answer chosen by Sandrine
RAM AnisettiRAM Anisetti
above one is not work for u..try this one...
 
global class Call {

    @Future

    Public static void calculate(String value)

    {

       //Do something

    }

}

 

All Answers

SandrineSandrine
I see that, static variabel and system.isFuture may serve my purpose, but i look for concrete solution
RAM AnisettiRAM Anisetti
try this one.
Callouts not supported to global classes.
public class Call {

    @Future(callout=true)

    Public static void calculate(String value)

    {

       //Do something

    }

}

 
RAM AnisettiRAM Anisetti
above one is not work for u..try this one...
 
global class Call {

    @Future

    Public static void calculate(String value)

    {

       //Do something

    }

}

 
This was selected as the best answer