Generate HTML formatted emails with Peoplesoft data elements

414 views Asked by At

I am trying to generate an App Engine program that will generate emails to employees with an upcoming employment anniversary (i.e. 5 years, 10 years, etc..) and display a sort of Countdown timer in the body of the email that has the Days remaining until their anniversary. I was thinking of using the MCF class framework in an App Engine program to do this. I will use the SERVICE_DT field from the PS_EMPLOYEES table to get the users in scope for an anniversary. I wanted to know how I can use PeopleCode to map the data elements (i.e. SERVICE_DT) into an HTML element that will display in the email. Any help on this or code examples would be helpful. Thanks in advance.

1

There are 1 answers

0
John On

I actually have created this kind of functionality in the past, except it wasn't intended for the employee with the anniversary. It worked for both Birthdays and Anniversaries, and it was used to notify HR, managers, etc. of upcoming events.

First you want to store an email template. This could be done in delivered workflow template pages or in a custom record.

In the template, you can include variables that your AppEngine program will replace. If this is going to just be for a single employee, it would be something like:

Dear $FirstName,

We are excited that your $Number anniversary will be on $Date.

Then in your code, you would read the template into a variable. And then substitute the values:

$template = Substitute($template, "$FirstName", &FirstName);
$template = Substitute($template, "$Number", &WhichAnniversary);
$template = Substitute($template, "$Date", &AnniversaryDate);

Then you would send the $template as the body of the email.

If you are using HTML emails, you could also send a list, just using one variable like $table in the template, and then build and HTLM Table in your AppEngine and substitute the variable like:

$template = Substitute($template, "$table", &table);