I was reading about Future methods in Salesforce and had this query - Is there any reason why future methods should be static and void?


1 Answer 1


Because you're not sure when future methods will be executed you can't rely on sending instance variables or waiting to use their results in your context. Otherwise you're waiting for a thread not executing a future method. So to answer your question.

They are static because they can't use instance variable They are void because you shouldn't expect a result that you use. If you want to make kind of thread, let the future method update a record and run a job to wait for results.

More on this here

Not the answer you're looking for? Browse other questions tagged .