function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
adrisseladrissel 

Urgent help! - Case Assignment Notifications Aren't Being Triggered

We are using Apex and VF for a Case Creation page for our customers on the community.  In the code we have the following, per Salesforce's documentation:
 
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
dmo.EmailHeader.triggerAutoResponseEmail = true;
dmo.EmailHeader.triggerOtherEmail = true;
dmo.EmailHeader.triggerUserEmail = true;
curCase.setOptions(dmo);
This works PERFECTLY as far as the case assignment rules go.  However, on most of the rules we have there are also automated notifications that are supposed to be sent immediately upon assignment to that queue/individual.  For some reason, only with cases filed via the VF page, these notifications aren't sent.  The cases are assigned properly, but no notifications.

These notifications are extremely important to our case-handling procedures here.  When I create test cases directly in Salesforce and use the assignment rules the notifications work perfectly.  Only cases file on the customer community prevent this.

Can anyone explain why this isn't working and help me with a fix?

Thanks!!!
 
Best Answer chosen by adrissel
adrisseladrissel
I found the answer to this issue and thought it would benefit the community here.  There was a line of code I didn't include in the above that makes it all work:
dmo.EmailHeader.TriggerUserEmail = true;

So the full code I am using looks like this now:
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
dmo.EmailHeader.triggerAutoResponseEmail = true;
dmo.EmailHeader.TriggerUserEmail = true;
curCase.setOptions(dmo);

For reference and credit I found the solution here (http://salesforce.stackexchange.com/questions/3338/case-assignment-rules-assign-to-queue-and-email-members-no-email-sent-inser/3351#3351).  

And, the Salesforce documentation on this being an option can be found here (https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_dml_database_dmloptions.htm#EmailHeaderProperty-B5377B04).

Thanks!!

 

All Answers

Phil WeinmeisterPhil Weinmeister
Hi adrissel. Yes, I have definitely encountered related issues when it comes to Case-related notifications associated with a Community. I don't have time to dig through the details of exactly what happened this moment (I'll try to post them when I have time), but I can say that I just ended up ditching the configuration-based email notifications under Support Settings (see below) and created Community-specific notifications. I drive a lot of the workflow rules off User Type = High Volume Portal to recognize that a Community user created a Case.

Overall, I'm not sure what the deal is with this, but it's clearly an issue. I wouldn't spend too much time troubleshooting and instead would just build the separate email alerts I mentioned previously.

Hope that helps!


Case Notifications
 
adrisseladrissel
Hey Phil,

I would do what you are saying with Workflow Rules and Email Alerts - one problem - my testing has proven that the "Case Owner" functionality of Email Alerts (i.e. to email something to the Case Owner) is also screwed up and doesn't appear to be working properly.  In the end, the Case Owner notification is what I'm trying to duplicate.

Thanks!
adrisseladrissel
I found the answer to this issue and thought it would benefit the community here.  There was a line of code I didn't include in the above that makes it all work:
dmo.EmailHeader.TriggerUserEmail = true;

So the full code I am using looks like this now:
Database.DMLOptions dmo = new Database.DMLOptions();
dmo.assignmentRuleHeader.useDefaultRule= true;
dmo.EmailHeader.triggerAutoResponseEmail = true;
dmo.EmailHeader.TriggerUserEmail = true;
curCase.setOptions(dmo);

For reference and credit I found the solution here (http://salesforce.stackexchange.com/questions/3338/case-assignment-rules-assign-to-queue-and-email-members-no-email-sent-inser/3351#3351).  

And, the Salesforce documentation on this being an option can be found here (https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_dml_database_dmloptions.htm#EmailHeaderProperty-B5377B04).

Thanks!!

 
This was selected as the best answer