4

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;     
1

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.
1

Actually, to trigger email notification to queue email or queue members, one needs to include the following option:

dmlOpts.EmailHeader.triggerUserEmail = true;

See Force.com Apex Code Developer's Guide.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.