[SalesForce] Assignment rules do not send notification email Queue email for Cases created from Site

I am creating a Case from site and the Assignment Rules are triggered, the record assigns as expected but no assignment notification email is sent to Queue email. The assignment rules are configured to send an email. Can anyone help to resolve this?

Apex Code:

AssignmentRule  AR = new AssignmentRule();
AR = [select id from AssignmentRule where SobjectType = 'Case' and Active = true limit 1];

//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;
dmlOpts.EmailHeader.triggerAutoResponseEmail = true; 
case_Book.setOptions(dmlOpts); 

/************End Assignment Rule**************/     

insert case_Book;     

Best Answer

To make the Case Notification to work when creating a case in APEX that is assigned via assignment rules you need to:

  • Include the DMLOption for responseEmail. Which you have done dmlOpts.EmailHeader.triggerAutoResponseEmail = true;
  • Add an email template to the actual assignment rule.
  • And configure the destination queue with one or both of the following settings:
    • Set "Send Email to Members" to true. All members will get an email.
    • Provide a Queue Email. Only one notification email will be sent to this email address.