Starting with Doug Ayers' Visualforce solution (thank you, Doug!) (https://douglascayers.com/2015/01/09/salesforce-send-calendar-invites-in-visualforce-email-templates/), I create the invite as a String and attach it to the email, which seems to be working well for capturing most of the event details, but I would like to include a link in the description, as this particular project is about webinar registrations. The 'DESCRIPTION:' field/node is not a fan of HTML, apparently, and drops everything after the first suggestion of a tag.
Here's the code for the text string:
public static String createCalendarInvite_EST(String organizerEmail, String slabel, DateTime startDT, DateTime endDT, String summary, String description) {
String newLine = '\n';
String result = 'BEGIN:VCALENDAR';
result += newLine + 'METHOD:PUBLISH';
result += newLine + 'VERSION:2.0';
result += newLine + 'PRODID::-//hacksw/handcal//NONSGML v1.0//EN';
result += newLine + 'BEGIN:VEVENT';
result += newLine + 'ORGANIZER:mailto:' + organizerEmail;
result += newLine + 'DTSTAMP;TZID=America/New_York:' + startDt.format('yyyyMMdd') + 'T' + startDt.format('yyyyMMddHHmmssZ').right(11).left(6);
result += newLine + 'UID:' + slabel;
result += newLine + 'DTSTART;TZID=America/New_York:' + startDt.format('yyyyMMdd') + 'T' + startDt.format('yyyyMMddHHmmssZ').right(11).left(6);
result += newLine + 'DTEND;TZID=America/New_York:' + endDT.format('yyyyMMdd') + 'T' + endDT.format('yyyyMMddHHmmssZ').right(11).left(6);
result += newLine + 'SUMMARY:' + summary;
result += newLine + 'DESCRIPTION:' + description;
result += newLine + 'BEGIN:VALARM';
result += newLine + 'TRIGGER:-PT1D';
result += newLine + 'ACTION:DISPLAY';
result += newLine + 'DESCRIPTION:Reminder';
result += newLine + 'END:VALARM';
result += newLine + 'END:VEVENT';
result += newLine + 'END:VCALENDAR';
return result;
}
(I've hard-coded the date/time as EST; GMT was resulting in a disconnect between the values as they appeared in the email body and the calendar entry, and I took a hammer to it. I'll revisit that another time ...)
I see where adding the email address after 'ORGANIZER:mailto:' works cleanly; does anyone have experience creating links in a related way?