You need to sign in to do that
Don't have an account?
pigginsb
DMLOptions Assigns Case But Doesn't Send Email to Queue Members
We are using Apex to create Cases in a customer community, and we have found that email notifications are not being sent to queue members when the Case is successfully assigned to a queue via the default assignment rule. Everything we've seen says to set the DML Options as shown in the below code, and this exact pattern is working elsewhere for Leads.
Has anyone else encountered this issue, or better yet resolved it?
public class CaseTest { public static void InsertTest(String value, String accountId, String contactId) { Case aNewCase = new Case( AccountId = anAccountId, ContactId = aContactId, Origin = 'Customer Community' ); aNewCase.Reason = 'Other'; aNewCase.Subject = value; aNewCase.Description = value; Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule= true; // successfully assigns case dmo.EmailHeader.triggerAutoResponseEmail = true; // but no email goes to the contact dmo.EmailHeader.triggerUserEmail = true; // and no email goes to the queue members aNewCase.setOptions(dmo); insert aNewCase; } }Additionally, when we create cases via the Salesforce UI, they are assigned correctly and the emails go out as expected. By this we conclude that there is no issue with the queue, the email template, or the email addresses of the assigned users.
Has anyone else encountered this issue, or better yet resolved it?
This is how I am doing.
All Answers
Updated the code and check if this works for you.
This is how I am doing.
Please mark this as solved.
Thanks,
Naval