Can someone help me understand whether it is possible via the REST or SOAP API (version 29) to trigger the email notifications that get sent when adding an invitee (e.g., contact, lead) to the EventRelation object (or updating the Event object)? I can add invitees via the API just fine, but no emails get sent to the contacts as they do when I do this via the web UI.
1 Answer
The standard emails can be sent out when the DmlOptions.EmailHeader
class is used to create the EventRelation object. Specifically you need to set the and properties.
Here's an example of this that has worked for me:
Database.DMLOptions dlo = new Database.DMLOptions();
dlo.EmailHeader.triggerOtherEmail = true;
dlo.EmailHeader.triggerUserEmail = true;
EventRelation er = new EventRelation(EventId = '00U000000000000',
RelationId = '005000000000000');
database.insert(er, dlo);