I have a workflow that has three field updates. I would like to know if these occur in sequential order. If I can guarantee they do occur in the order I have set out I can accomplish my use case without a trigger.
-
2There is no way you can explicitly indicate the order of any of the business logic features (triggers, workflows, validation rules) when you have many of them executing on the same record. But with workflows, you can chain together field update actions where new execution criteria test to true. In this way you could potentially create an implicit action order. Have you tried playing with this?– pchittumCommented Jan 9, 2014 at 18:37
1 Answer
The field updates occur "simultaneously", and therefore you cannot predict the behavior of the updates. Also, workflow rules are evaluated "simultaneously", meaning that one field update won't necessarily be visible to other rules, but you can choose to "re-evaluate workflow rules" to chain them together (up to 5 times).
Specifically, Salesforce follows logic similar to the following pseudo code:
set retrycount to 0
do
if retrycount equals 5
report error
abort transaction
end if
set retry flag to false
for each rule
if rule is true
add to execution list
end if
end for
for each rule in execution list
for each action
if reevaluate flag is true
set retry flag to true
end if
execute action
end for
end for
increment retrycount
while retry flag is true
Note that Salesforce may not internally operate verbatim, but this "code" is meant to be illustrative of how you can expect workflow rules to behave.