+ Start a Discussion
Grant Ongstad 3Grant Ongstad 3 

Order Of Execution - Field Update In Apex

Hello Developers,

I'm in a bit of a pickle here. 

I have a future apex class that Updates the Opportunity Owner based on certain, and sometimes complex criteria.

Due to the nature of the class, sometimes the Opportunity Owner takes a few seconds to update but after a few refreshes, I'll see that the code has done its job.

What I have been tasked to do is to notify Super Users when the Opportunity Owner does not change, but remains Owned by our default 'Data Migration' User.

I tried creating a workflow that sends an email when the Opportunity OwnerID = Data Migration ID, but since the Owner ID takes a while to change the email is sent no matter what.

Is there a way to verify that the Apex Update has been done BEFORE checking for the Condition to send an email?