Problem: the standard Salesforce "Case transferred to you" mail is ALWAYS being sent, despite the fact that we do not want it.
Description: We have set up Email-to-Case and in the EmailMessage
trigger we set some fields of the case correctly and then we update the case:
Database.DMLOptions dmlo = new Database.DMLOptions();
dmlo.EmailHeader.triggerUserEmail = false;
Database.update(cases, dmlo);
In Before Update Case trigger we look for the correct user and assign the case to this user:
if (conditionA) {
c.OwnerId = ownerA;
} else if (conditionB) {
c.OwnerId = ownerB;
} // etc.
In Email-to-Case setup we unchecked the "Notify Case Owners on New Emails".
Also, in Support Settings the checkboxes "Notify Default Case Owner" and "Notify Case Owners when Case Ownership Changes" are both unchecked.
And now the funnier part:
- If we change the case owner manually in Dev console(Execute anonymous), then a notification is NOT sent
- If we change the case owner in the UI and explicitly say that we do want an email(checkbox), then a notification is NOT sent
- For a test we hardcoded a new owner id for the cases and tried the Email-to-Case way once again. The owner was set and we did get a notification!
- Then we also did a dummy update to a record(edit-save), the owner was changed, but the notification was NOT sent!
Did anyone ever see such a weird behaviour? How can we disable these notification mails?