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
AbAb 

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 Ab
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

AbAb
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