Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ics-event-emails

A service for sending templated emails, with optional ICS (iCalendar) meeting invites attached. Built to be called two ways — synchronously from a Flow, or asynchronously by publishing a platform event.

Features

  • Sends every request in a batch through one Messaging.sendEmail call, regardless of batch size.
  • Can attach a calendar (.ics) file to the email, with REQUEST, CANCEL, or PUBLISH as the method, an ATTENDEE line, and an optional ORGANIZER line.
  • Same send logic runs whether it's called directly from a Flow or through the Send_Email_Event__e platform event.
  • An unresolved template, a recipient without an email address, or a failed send is skipped and logged instead of stopping the rest of the batch.

Components

Component Purpose
SendEmailInvocable @InvocableMethod — call directly from a Flow as the Send Templated Email action.
Send_Email_Event__e Platform event — the async boundary. Publish a record to queue a send without holding up the publishing transaction.
SendEmailEventService Maps delivered Send_Email_Event__e records to SendEmailInvocable requests and validates ICS_Method__c, since platform events can't use a Validation Rule.
SendEmailEvent after insert trigger that delivers the platform event to SendEmailEventService.
ICS Event Emails Permission set with the access needed to publish Send_Email_Event__e and invoke the invocable action.

Usage

Trigger a send either by:

  1. Adding the Send Templated Email invocable action to a Flow, or
  2. Publishing a Send_Email_Event__e record — a Create Records element in a Flow, or EventBus.publish(...) from Apex.

Both accept the same set of fields:

Field Invocable Variable Platform Event Field Required Description
Email Template API Name templateName Email_Template_API_Name__c Yes Developer name of the EmailTemplate to send.
Recipient Contact ID recipientContactId Recipient_ID__c Yes Contact to send to.
Recipient Email recipientEmail Recipient_Email__c Used for the ICS ATTENDEE line.
Sender Address senderAddress OrgWideEmailAddress__c Org-wide email address; uses the org default when blank.
Related Record ID whatId Related_Record_ID__c Record the email relates to, for merge fields and activity logging.
Log Email on Send logActivity Log_Email_on_Send__c Logs the email as an activity on send.
ICS Subject icsSubject ICS_Subject__c SUMMARY line of the attached calendar event.
ICS Start Time icsStartTime ICS_Start_Time__c Setting this attaches a calendar file to the email.
ICS End Time icsEndTime ICS_End_Time__c Defaults to one hour after the start time.
ICS UID Record ID icsUid ICS_UID__c Stable identifier for the event; reuse it across sends so reschedules update the same calendar entry.
ICS Method icsMethod ICS_Method__c REQUEST (default), CANCEL, or PUBLISH.
ICS Organizer Email icsOrganizerEmail ICS_Organizer_Email__c Adds an ORGANIZER line identifying who scheduled the event.
ICS Organizer Name icsOrganizerName ICS_Organizer_Name__c Display name for the ORGANIZER line.

Development

To work on this project in a scratch org:

  1. Set up CumulusCI
  2. Run cci flow run dev_org --org dev to deploy this project.
  3. Run cci org browser dev to open the org in your browser.

About

Enables sending of emails with ICS event attachments, so recipients can add the details to their calendars

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages