Creating a Custom iCal file to be Emailed to User

Posted by stephen.vanrooyen on 28-Jun-2017 06:28

Hi Guys,
 
Since Rollbase does not allow events greater than 1 day, I created my object without the Event attribute.
 
I now need to create a custom iCal file for this object, and mail the iCal file to the user.
I thought of using a document template, (which unfortunately does not allow templates with the extention .ics)
But If I create it as a plain text template (txt) it works as expected, (except that the extension is incorrect)
 
I there another way to achieve what im trying to do?
 
Regards,
http://www.aigs.co.za/templates/email_signatures/2016/stephen_van_rooyen.png
 

Posted by stephen.vanrooyen on 03-Jul-2017 06:43

Hi,

I figured it out eventually, here is the solution in case someone experiences a similar problem.

I used a plain text document template, for the ical template.

I create a file upload field to store the generated ical file.

then using an object script trigger, that runs after an update on the record,

I generated the output of the template using the "rbv_api.runTemplate" method, which returns the base-64 encoded string, of the generated template.

I then use the base-64 encoded string, to populate the file upload field using the "rbv_api.setBinaryFieldValue" method,

which also allows me to change the mime type to "text/calendar" as well as the filename and extension to .ics.

I then use the token of the uploaded file in my email, which results in the .ics file being attached in the email to the user.

Regards,

Stephen

Posted by stephen.vanrooyen on 03-Jul-2017 06:49

Hi Guys,

I figured it out eventually, here is the solution in case someone experiences a similar problem.

I used a plain text document template, for the ical template.

I create a file upload field to store the generated ical file.

then using an object script trigger, that runs after an update on the record,

I generated the output of the template using the "rbv_api.runTemplate" method, which returns the base-64 encoded string, of the generated template.

I then use the base-64 encoded string, to populate the file upload field using the "rbv_api.setBinaryFieldValue" method,

which also allows me to change the mime type to "text/calendar" as well as the filename and extension to .ics.

I then use the token of the uploaded file in my email, which results in the .ics file being attached in the email to the user.

Regards,

Stephen

Posted by stephen.vanrooyen on 04-Jul-2017 06:09

Hi Guys,

I figured it out eventually, here is the solution in case someone experiences a similar problem.

I used a plain text document template, for the ical template.

I create a file upload field to store the generated ical file.

then using an object script trigger, that runs after an update on the record,

I generated the output of the template using the "rbv_api.runTemplate" method, which returns the base-64 encoded string, of the generated template.

I then use the base-64 encoded string, to populate the file upload field using the "rbv_api.setBinaryFieldValue" method,

which also allows me to change the mime type to "text/calendar" as well as the filename and extension to .ics.

I then use the token of the uploaded file in my email, which results in the .ics file being attached in the email to the user.

Regards,

Stephen

All Replies

Posted by Santosh Patel on 28-Jun-2017 07:40

Save the custom file in a file upload field on the object. Use template token (will replace the token with a file attachment) for the field in either a mail template or document template.

Posted by stephen.vanrooyen on 03-Jul-2017 06:43

Hi,

I figured it out eventually, here is the solution in case someone experiences a similar problem.

I used a plain text document template, for the ical template.

I create a file upload field to store the generated ical file.

then using an object script trigger, that runs after an update on the record,

I generated the output of the template using the "rbv_api.runTemplate" method, which returns the base-64 encoded string, of the generated template.

I then use the base-64 encoded string, to populate the file upload field using the "rbv_api.setBinaryFieldValue" method,

which also allows me to change the mime type to "text/calendar" as well as the filename and extension to .ics.

I then use the token of the uploaded file in my email, which results in the .ics file being attached in the email to the user.

Regards,

Stephen

Posted by stephen.vanrooyen on 03-Jul-2017 06:49

Hi Guys,

I figured it out eventually, here is the solution in case someone experiences a similar problem.

I used a plain text document template, for the ical template.

I create a file upload field to store the generated ical file.

then using an object script trigger, that runs after an update on the record,

I generated the output of the template using the "rbv_api.runTemplate" method, which returns the base-64 encoded string, of the generated template.

I then use the base-64 encoded string, to populate the file upload field using the "rbv_api.setBinaryFieldValue" method,

which also allows me to change the mime type to "text/calendar" as well as the filename and extension to .ics.

I then use the token of the uploaded file in my email, which results in the .ics file being attached in the email to the user.

Regards,

Stephen

Posted by stephen.vanrooyen on 04-Jul-2017 06:09

Hi Guys,

I figured it out eventually, here is the solution in case someone experiences a similar problem.

I used a plain text document template, for the ical template.

I create a file upload field to store the generated ical file.

then using an object script trigger, that runs after an update on the record,

I generated the output of the template using the "rbv_api.runTemplate" method, which returns the base-64 encoded string, of the generated template.

I then use the base-64 encoded string, to populate the file upload field using the "rbv_api.setBinaryFieldValue" method,

which also allows me to change the mime type to "text/calendar" as well as the filename and extension to .ics.

I then use the token of the uploaded file in my email, which results in the .ics file being attached in the email to the user.

Regards,

Stephen

This thread is closed