[SalesForce] Standard Case Notification when Owner is Changed via Visualforce page not working

Currently we have a setup wherein when the owner of a case is updated via a Visualforce page.

The problem is the Standard Case Notiifcation when the owner is changed is not being sent out when the owner is changed thru the visualforce page.

We already have defaulted the "Notify Case Owners when Case Ownership Changes" setup in Setup>Case>Support Settings
but no notification is still being sent when the owner is updated via the custom page.

But if we change the owner using the standard [Change] link within the Case Detailed page. the Case Notification is being sent to the new owner.

Is there a reason why when the Case Owner is updated via a Visualforcepage it doesn't fire the Case Notification email when the owner is changed?

NOTE: We are not using Assignment Rules just the Standard Case Notification alert when the Owner is changed

Thanks!!

Best Answer

You want to look into using DMLoptions in your Apex.

See the docs below but the general usage is as follows

Database.DMLOptions options = new Database.DMLOptions();
options.EmailHeader.triggerUserEmail = true;
database.update(your_object, options); 

https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_dml_database_dmloptions.htm#EmailHeaderProperty-B5377B04

Related Topic