[SalesForce] Process builder sending multiple mails on production

I have this process, built with process builder, that triggers an Apex class to send a single email, under a condition: that a Case has a specific Status.

In the sandbox, this works perfectly. On production, it aways sends the same mail four times. I haven't found any instances (yet) where it works like it is supposed to.

Process and Apex class are identical on production and in sandbox. What gives?

Edit 1:

In production, the change in Case Status is triggered by a workflow that has a Time-Dependent Workflow Action with a trigger date more than one month in the future. In the sandbox, this is impractical, so there I always edit the Status into the desired value. Just to be sure that the workflow was not the cause, I changed the one month trigger into a one hour trigger. And I observed the same behaviour as in production! For some reason, a change by the workflow triggers the process 4 times, whereas a manual edit only does this once.

And yes, the "Do you want to execute the actions only when specified changes are made to the record?" checkbox is on for the Case Status condition. I "just" have to find out why that seems to be ignored in this case.

The Evaluation Criteria for the workflow are: Evaluate the rule when a record is created, and any time it's edited to subsequently meet criteria and the Rule Criteria is: Case: Status equals 'Some state'

Something else: as well as in production, the process sends 4 mails in the sandbox. Four mails every time. Why not two, three or five?

Edit 2:

4 = 5 – 1. I notice that in the log, the process that (among other things) sends the emails, is going into recursion five times, which is the documented maximum. In its first recursion, it's doing something useful, and in the following 4 recursions it's sending the four mails. Somehow, a change by a workflow causes a recursion 5 deep, but a change by a manual edit doesn't, at least not as deep: just the 2 required 'levels'.

Best Answer

I would check the following:

  • Are there any active workflows that trigger additional emails (EDIT: check if that workflow is set to "Re-evaluate Workflow Rules after Field Change")
  • Is there a possibility that the same record gets evaluated multiple times (i.e. Process is triggered a second / third / fourth time due to an update inside of the Process)
Related Topic