0

I am facing an issue with Case Assingment Rule Email feature.  I have a visual force page from where I can create a case, case assignment is working as expected but email is not sending to the target user or queue.

Settings what I have:

  1. Created a queue and add a user in that queue, enable the checkbox with send email to members. 
  2. Created assignment rule and set the case to created queue in step 1 and choose the desired template. 
  3. Support Settings:  Checked Notify Default Case Owner but that sends the generic email when no assignment rule matches. But in case of matching with case assignment rule no email.  Case Creation Template (chosen) Case Assigned Template (chosen)
  4. As I am on sandbox so I enabled these settings too: Email->Deliverability->Access level-> All Email
  5. Email with process builder and workflow rules is working fine(Tested)

What I noticed, case assignment rule assigns the case to respective queue or user when I see from the case detail page after creation. 

Then I thought I should check using APEX class code and that do the same behaviour which as mentioned above such as assign the case to queue or user but no email. Here is the code which I have tried. 

    //Fetching the assignment rules on case
    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.TriggerUserEmail = true;
    dmlOpts.EmailHeader.triggerAutoResponseEmail = true;
    List<Case> newCases = new List<Case>();
    Case c = new Case();
    c.Accountid = '0011w00000lIGLXAA4';
    c.Type = 'ICM';
    c.Origin = 'Web';
    c.Status = 'New';
    c.FirstName__c = 'Kamran';
    c.LastName__c  = 'Jabbar';
    newCases.add(c); 
    c.setOptions(dmlOpts);
    insert newCases;

Can you please guide me on this issue?  How can I fix it?  I already spent much time on it but no success, if I am missing any configuration, please guide on it. Thank you. 

1
  • What I noticed here, when we create case using email-to-case then it sends the email. Sep 1, 2020 at 9:32

1 Answer 1

0

The issue was a critical update which we fixed after contacting with support.

Update Name: Stop Automated Field Updates from Suppressing Email Notifications

Update Summary: This update stops processes, workflow rules, and Apex triggers from suppressing email notifications.

Sources:

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.