How to implement logic to send email notification

Hi all, I got stuck at place please help me to implement one logic. I have list of employees along with its joining date. So I have to implement a functionality where I have to send employee anniversary notification to manager before two and one week for those employee who completed 1 year, 5 years and 10 years respectively. I am not understanding how to implement this logic. Can anyone tell me how can I implement this. Thanks in advanced
2 answers

I'd use a daily scheduled event. In the microflow, create six datetime variables (assuming you have the joining date non-localized):
addWeeks(addYears([%BeginOfCurrentDayUTC%], -1), -1) (this is the joindate for employees whose manager needs a one week notification for the one year anniversary)
addWeeks(addYears([%BeginOfCurrentDayUTC%], -1), -2) (same, now the two week notification)
addWeeks(addYears([%BeginOfCurrentDayUTC%], -5), -1) (one week notification for five year anniversary)
addWeeks(addYears([%BeginOfCurrentDayUTC%], -5), -2)
addWeeks(addYears([%BeginOfCurrentDayUTC%], -10), -1)
addWeeks(addYears([%BeginOfCurrentDayUTC%], -10), -2)

Now you can retrieve employees six times, where joindate = datetime variable. Loop over them to send an email to the manager for each employee you found.


From your comments it looks like you already have a MF which can RUN everyday, Has a List of Employees with 1 Year Anniversary, a List of Employees with 5 Year Anniversary and a List of Employees with 10 Year Anniversary.
Assuming all this is ready in a MF, you now have to send email to these 2 lists.


So add 3 SUB MF’s which takes in a List of Employees. In this SUB MF,

  1. Pull the email addresses of all these employees in the list(you can loop over the list)
  2. create a large string which contains all email with a COMMA as a seperator
  3. Call SendEmail Java Action which is available in the EmailConnector Module which can send an email to all the emails which you prepared in Step 2 (pass in the To attribute of the java action)

Do 2 more SUB MF’s for 5 Year, 10 year respectively(i am assuming you may have a different email body for each of the Anniversary types)


Good luck.