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
CaffeineCaffeine 

Question: TriggerFuture method cannot be called from a future method

I'm doing a RunAllTests and am getting the following:

Exception in Account_AsynchProcessing TriggerFuture method cannot be called from a future method: formatSObjectData(String, LIST:String)

 

I'm not sure what the Exception is saying.  Here is the setup:

-  A trigger has a statement that calls a @future method in a global class.  The future method itself does not make calls to other future methods.

 

Is it invalid to call @future methods from a trigger?

 

Thanks.

 

 

 

werewolfwerewolf
You can call @future methods from triggers.  See here, for example.
Message Edited by werewolf on 04-15-2009 06:57 PM
werewolfwerewolf
Maybe it's saying that you're trying to call one @future method from another @future method?
CaffeineCaffeine

Wolf,

thanks for the note.  There's only one @future method in the class.  That method is calling other methods in the class, but none of them are annotated as @future.

werewolfwerewolf
Is your @future method perhaps trying to call a non-static method?
pbulaczpbulacz

Could be similar to something I've come across. Are you firing a @future method from a trigger that is being fired BY a future method?

 

I had 1 object  with a future method on it's trigger. but another future method also updated that object in it's logic as part of something else and I got this error.

 

From the language reference.

 

 

You cannot call a method annotated with future from a method that also has the future annotation. Nor can you call a trigger from an annotated method that calls another annotated method.

 

 

 

 

 

 Patrick

Message Edited by pbulacz on 07-09-2009 10:19 PM