You need to sign in to do that
Don't have an account?

Dynamically populating meeting.ics file within a visualforce template
I found this article online which shows how to create a visualforce email template, that can send an email with an ics attachment.
http://developer.force.com/cookbook/recipe/creating-email-templates-and-automatically-sending-emails
<messaging:emailTemplate subject="Received your resume" recipientType="Contact" relatedToType="Job_Application__c"> <messaging:plainTextEmailBody > Dear {!relatedTo.Candidate__r.First_Name__c} {!relatedTo.Candidate__r.Last_Name__c} Thank you for your interest in the position {!relatedto.Position__r.name} We would like to invite you for an interview. Please respond to the attached invitation. Regards, Company </messaging:plainTextEmailBody> <messaging:attachment filename="meeting.ics" renderAs="text/calendar; charset=UTF-8; method=REQUEST"> BEGIN:VCALENDAR METHOD:REQUEST BEGIN:VTIMEZONE TZID:(GMT-08.00) Pacific Time (US and Canada) BEGIN:STANDARD DTSTART:16010101T020000 TZOFFSETFROM:-0700 TZOFFSETTO:-0800 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=11;BYDAY=1SU END:STANDARD BEGIN:DAYLIGHT DTSTART:16010101T020000 TZOFFSETFROM:-0800 TZOFFSETTO:-0700 RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTH=3;BYDAY=2SU END:DAYLIGHT END:VTIMEZONE BEGIN:VEVENT DTSTAMP:20090921T202219Z DTSTART;TZID="(GMT-08.00) Pacific Time (US and Canada)":20090923T140000 SUMMARY:Invitation: Interview Schedule @ Wed Sep 23 2pm - 4pm ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE; CN="{!recipient.name}":MAILTO:{!recipient.email} ORGANIZER;CN="John.Smith":MAILTO:recruiter@company.com LOCATION:Hawaii DTEND;TZID="(GMT-08.00) Pacific Time (US and Canada)":20090923T160000 DESCRIPTION: You are invited to an inverview \NInterview Schedule \NWed Sep 23 2pm - 4pm (Timezone: Pacific Time) \NCalendar: John Smith \N\NOwner/Creator: recruiter@company.com \NYou will be meeting with these people: CEO Bill Jones, Office Manager Jane Jones \N SEQUENCE:0 PRIORITY:5 STATUS:CONFIRMED END:VEVENT END:VCALENDAR </messaging:attachment> </messaging:emailTemplate>
The problem I'm running into is assigning the DTSTART and DTEND values from a Date/Time field on a record. When I put the field there, I don't think it's in the correct format, and even if it was, I think it's showing as GMT.
Does anyone have advice or have worked with something like this in the past?
Thanks!
DTSTART;TZID="(GMT-05.00) Central Time
(US and Canada)": <apex:outputText value="{0,date,yyyyMMdd'T'HHmmssZ}"><apex:param value="{!RelatedTo.StartDateTimeField - (5/24)}"/></apex:outputText>
DTEND;TZID="(GMT-05.00) Central Time
(US and Canada)": <apex:outputText value="{0,date,yyyyMMdd'T'HHmmssZ}"><apex:param value="{!RelatedTo.EndDateTimeField - (5/24)}"/></apex:outputText>
5/24 represents Central Time Zone.