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
Jacob W LandisJacob W Landis 

How to make sure email alert trigger before field update

Hi,

I have a custom object, myrequest__c, which has a checkbox field, resent__c. I want to have a workflow rule on this object when created, and everytime is edited. The condition is AND(ISCHANGED(resent__c), resent__c!=false). and there are two email alerts and one field update in the rule. What we want is whenever the data is created or the resent field is checked, the emails should send to sender and receiver and then change the resent field to false. But I found the only one email sent out, not the other one, is there a way to make sure the order of the workflow actions?
bob_buzzardbob_buzzard
Unfortunately not. The only guarantee is the opposite of what you want - field updates are fired first.

If you can place your email alerts into separate rules, you may be able to use the workflow rule re-evaluation after field updates:

https://help.salesforce.com/HTViewHelpDoc?id=workflow_field_updates_reevalute_wf.htm&language=en_US
Jacob W LandisJacob W Landis
How about have 2 workflow, 1st is to reset resent from true to false and check thre revalidate the other workflow rules, the 2nd is send emails out if AND(ischanged(resent__c), priorvalue(resent__c)=true). I have tried it, but the email is not send out. anything wrong?
bob_buzzardbob_buzzard
I think this is due to the way that ischanged works, although it has been a little while since I've used this particular scenario. While I've never found it documented, my findings are that this doesn't take into account the interim value after your workflow rule fires, but the original and new values on the record before worfklow processing started.  You should be able to confirm this by turning on logging for the transaction, as that will show you the workflow rule being evaluated and the outcome.