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:
dmlOpts.EmailHeader.triggerAutoResponseEmail = true;