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
VarunCVarunC 

Why would DmlOptions EmailHeader not work for Event Creation with email notifications?

I have a code sample as below:
Database.DMLOptions dmlo    = new Database.DMLOptions();
dmlo.EmailHeader.triggerUserEmail = true;
database.insert( this.myNewEventsWithEmail, dmlo );
system.debug('@@ Create Events (With EMAIL) : ['+myNewEventsWithEmail.size() + '] ( '+dmlo+' )');
where 
myNewEventsWithEmail
is list of Event object records.

My debug log says that this code was executed and with correct EmailHeader option:
02:49:32.033 (1033993374)|USER_DEBUG|[430]|DEBUG|@@ Create Events (With EMAIL) : [2] ( DMLOptions:[AllowFieldTruncation=null, AssignmentRuleHeader=AssignmentRuleHeader:[AssignmentRuleId=null, UseDefaultRule=null], DuplicateRuleHeader=DuplicateRuleHeader:[AllowSave=null], EmailHeader=EmailHeader:[TriggerAutoResponseEmail=null, TriggerOtherEmail=null, TriggerUserEmail=true], LocaleOptions=null, LocalizeErrors=null, OptAllOrNone=null] )
I have verified that triggerUserEmail is set to True but still No Email is being sent to the user who is assigned the Event.

Weird thing is, same code works just fine with list of Task object records.
ShashankShashank (Salesforce Developers) 
As per existing functionality, we can send assignment emails for tasks but not for events. Here is an idea around this that you can vote for: https://success.salesforce.com/ideaView?id=08730000000726w