I am trying to automatically send emails based on specific dates. For example to send an email 6 months ahead of a particular date another one in 3 months of that date, 2 months and 1 month time to the date.
Is there a particular activity that can be used in order to accomplish this, or has someone done something similar that they could share?
Thanks in advance for your time,
You can schedule this with orchestrator buddy with schedule option, you can send the mail at any interval you want kindly have a look at this buddy that could help you resolve this for sure
You can create a DateTime object and set its value to the deadline that you want to send emails about. For example an Assign activity block could say Deadline = new DateTime(2019,12,1) which would be December first. (Full DateTime constructor info can be found here)
To check for if the deadline is six months out you can subtract six months from the deadline:
varToday = DateTime.Today
varDeadlineSixMonths = Deadline.AddMonths(-6)
Then check if the day/month/year are the same. If they are then the deadline date is six months from now. To check for 3/2/1 months out just subtract that amount from the deadline instead of 6.
varToday.Day = varDeadlineSixMonths.Day
If all true send an email.
Hi @DanielMitchell, @Palaniyappan
Thanks for your response. In my instance there is no one specific expiry date to check (for example when you mentioned about assigning a date), emails are sent automatically based on checking the expiry dates kept in an excel sheet to the current date. So if the date read in ‘expiry date’ column is equal to 6 months to current date then send email, and it will keep checking the other dates in the column to ensure that the expiry date is not less than 6 months.
The dates in the column will all be different, so it will always have to check current date at the time it is run and check expiry date, as mentioned if that date is = to 6 month then send email
I hope this makes sense?
That sounds good.
Just read the excel data and loop through it. For each date you can assign it to a variable and then perform the check to see if you are six months in advance. It’s the exact same logic, you just need to do it in a loop.