92
Views
14
Comments
Trigger Email To User 6 months before their birthday
Question
Application Type
Reactive

Hi any one can help with the following;

i need to trigger an email from the start of the year to user 6 months before their birthday. The intention is to get them to update in the system what they wish for the birthday present.

There are 2 task i need to do

  1. How i calculate their age 6 months before their current year date of birth
  2. If their age  in task 1 is 62 or more but less than  or equal 70 than  i will send the email

To calculate age Year(CurrDate())-Year(Employee.dob) (Not sure if this is correct to calculate the age of employee in current year)

Action : 

If(Month(CurrDate())+6 >=Month(StmEmployee.dob),"Trigger","Do Nothing") (Is this check correct )



I will need to send the email 6 months before the dob, but if the dob is already past the current date and the employee had not responded i will still continue to send the reminder 

Thank you in advance

2023-03-03 06-59-12
Reemali patil

Hi Jerah,

To calculate the age of an employee 6 months before their current year's date of birth and send mail, you can use the following steps:

1.Get the current date: CurrDate()

2.Subtract 6 months from the current date: AddMonths(CurrDate(), -6)

3.Extract the year from the date obtained in step 2: Year(AddMonths(CurrDate(), -6))

4.Calculate the age by subtracting the year of birth from the year obtained in step 3:    Year(AddMonths(CurrDate(), -6)) - Year(Employee.dob).


Here is the OML file & image attached, take the reference from it.

Thanks

Reemali.

send mail.oml
2021-06-13 07-48-30
Jerah

Thank you for you reply but your method it does not take into consideration the days

2024-01-04 15-15-51
Abed Al Banna

Hi @Jerah, it's not so clear what your question is, but if you're asking how can you trigger sending out an email to users 6 months before their birthday or under different conditions, you can use a timer for that. There's no need to add those 2 additional attributes to your entity as you can calculate them inside the timer's server action.

Schedule the timer to run once every day, where you check if your conditions have been met, in which case you send out an email to the user in question.

Additionally, if you would like to calculate the age of the person, I recommend doing so as such: 

Trunc(DiffDays(Employee.dob, CurrDate())/365).

I hope this helps! 

2024-09-12 02-43-38
Deepsagar Dubey

Hi @Jerah 

If i understood your requirements correctly then you want to send email to employee whose birthday will come after 6 months.

i.e. Today is 5th June and you want to send email to employee  whose will be on 5th December.

So to do that Add 6 months in current date then match only Date and Month with your saved record (DOB) in entity.

If date and month matched then compare year from current year to DOB year if it's more than 62 and less than 70 then trigger an email along with keep this data in an entity.

You can use in your entity to determine whether email sent or not if not sent then you can schedule a timer to check failed email and try to send again.

I hope it'll help you.

Thanks
Deep

2021-06-13 07-48-30
Jerah

No it is 6 months before DOB for current year

2024-09-12 02-43-38
Deepsagar Dubey

ohh okay so it means if someone has birthday on 5th Dec then you need to send email today or if someone has birthday on 5th Jan then you need to send email today.

if you give an example like this then it'll be more clear.

2021-06-13 07-48-30
Jerah

See the screen shot i included in my post

UserImage.jpg
Henrique Cavaleiro

Hi @Jerah 

There are some specific cases we must have into consideration.

On some dates just subtracting months is not enough. For example, if my birthday is 31/08 when should I send the email? 28/02 or 01/03? Because the 31/02 date does not exist.

There are other situations like this.


Regard,

Henrique


2021-06-13 07-48-30
Jerah

Hi while searching in the forum i saw someone posted this formula which seem to be calculating the birthdate of the person on the current day 

Day(CurrDate())+Month(CurrDate())*100 < Day(Employee.dob)+Month(Employee.dob)*100,Year(CurrDate())-Year(Employee.dob)-1,Year(CurrDate())-Year(Employee.dob)

I simply replace it with my value , but not sure exactly how it work seem good though

UserImage.jpg
Nani

Hi,
jerah create a timer and it should run every day morning and inside a timer action filter the table add filter where date =currdate+ 6months, so you will get 6months before date of birth list and run loop on table list to send mail to every records in the list.
inside the loop add " Reemali patil " logic which she as give before in chat and make some cahnges in if condition where you need compare first month and after date.
if you compare with days instead of month it will be much easier to write a logic like before 180 days 
i hope this might help you jerah
if you need any help please let me know
thank you 

2023-05-30 10-05-13
Lourenço Matalonga

Hi Jerah,

it does help everyone in the community if you mark an answer as a solution. Ofc only if it has solved your problem. If it hasn't helped you but you found a solution it would be also great if you would share the solution in this thread.

Thank you. 

Best regards,

Lourenco Matalonga

2023-06-19 12-31-04
Sagar Rakshale

Hi @Jerah,

I created a simple JavaScript program to compute age for the upcoming six months. I also added defined additional conditions to determine whether or not an email should be sent.

Please use the screenshot and OML file that are provided for reference, and let me know if it functions properly for you.



Best regards,

Sagar R

BirthdayNotification.oml
2023-06-19 12-31-04
Sagar Rakshale

Hi @Jerah

Make this thread "solved" if your issue has been resolved.


Best Regards,

Sagar R

2024-09-27 19-05-42
Ravi Kumar Tasubilli

Hi, Jerah

You can try this way

1.First store the all employee DOB in entity and fetch through aggregate.

2.In aggregate just add filter By using function DiffDays(DOB,CurrDate) = 180

now aggregate return some List or record, So now you can send the email to list output.

Regards,

Ravi


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.