[SalesForce] Disable sending email when close a case and change owner

I would like to know if it's possible to disable sending of an email when the case is closed and when the owner of the case changes?

In the "support settings" for case, the checkbox "Notify Case Owners when Case Ownership Changes" is disabled.

So I don't understand why an email is sending to the owner when a case is closed or if the owner changes..

The email is sended since I developed an Apex trigger which set the user as owner when he changes the status of a case.

Can you help me please?

Regards
Aurélien

Best Answer

Try clearing out the Case Assigned Template in the Support Settings.

And/Or in your trigger try setting the DML Header properties, the following example is from the docs here.

Usage

Even though auto-sent emails can be triggered by actions in the Salesforce user interface, the DMLOptions settings for emailHeader take effect only for DML operations carried out in Apex code.

Account a = new Account(name='Acme Plumbing');

insert a;

Contact c = new Contact(email='jplumber@salesforce.com', firstname='Joe',lastname='Plumber', accountid=a.id);

insert c;

Database.DMLOptions dlo = new Database.DMLOptions();

dlo.EmailHeader.triggerAutoResponseEmail = true;

Case ca = new Case(subject='Plumbing Problems', contactid=c.id);

database.insert(ca, dlo);
Related Topic