2

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 this.myNewEventsWithEmail is list of Event sObjects.

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.

1 Answer 1

3

Varun, I don't think that Salesforce sends notification emails to an internal user when a new Event is created that is assigned to that user. This functionality only exists for Tasks.

To verify this for yourself, try using the standard Salesforce UI to create a new Event record assigned to a user other than yourself, and see if Salesforce sends you an email --- it won't. (Go to /00U/e to create a new Event, /00T/e to create a new Task)

1
  • weird, I didn't realized that, thnx for pointing it out.
    – VarunC
    Apr 14, 2015 at 13:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .