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
GoForceGoGoForceGo 

@future execution

 

Given that @future execute async, I suspect there are not guarnantees, but I thought I would ask:

 

I am in a before insert trigger and I call @future.

 

Is there any guarantee that my insert trigger (the current transaction thread) will complete before the async. method is called.

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
spraetzspraetz

The current transaction thread will always complete before the async method is started. 

 

It's like this because if we hit an exception in the synchronous thread, we need to rollback all of the activity of the thread prior to that, which includes placing @future methods on the queue. 

All Answers

spraetzspraetz

The current transaction thread will always complete before the async method is started. 

 

It's like this because if we hit an exception in the synchronous thread, we need to rollback all of the activity of the thread prior to that, which includes placing @future methods on the queue. 

This was selected as the best answer
GoForceGoGoForceGo

Okay thanks. Makes sense. Good to know you can count on it.