I’m working on a feature where I need to send “Congratulations” notifications to users who have a birthday today. The goal is:
Daily: Every morning, a manager should receive a notification with a list of employees whose birthday is today.
Weekly: Every Sunday, the manager should receive a notification with a list of employees who have a birthday in the upcoming week.
The Challenge:
I have a field named “Birthday” that stores each user’s birthdate. However, I want to achieve this without storing additional fields like Birthday Month and Birthday Day.
Question:
Has anyone successfully implemented something similar without adding extra fields? If so, what approach did you use?
Would love to hear any ideas or best practices. Thanks in advance for your help!
you’d need to run a bulk update to store the information and then change how the birthdate is stored going forward (so you don’t have to bulk update again)
Edit: Ignore this idea–it includes the basic error of not accounting for the year. I assume you don’t need additional fields and could simply include (in the daily/weekly workflow that sends a notification to the manager) the results of a search of Users whose birthday falls within the range that starts at the beginning of today (or this week) and ends at beginning of tomorrow (or next week).
FWIW, there’s an even simpler version of this technique for evaluating whether a past year’s date matches today’s date or falls within the current week’s date range: Change the year of the date being evaluated to the current year and then use the handy equals rounded down to operator to compare to the current date. However, the relevant operators are not available in search constraints and therefore not applicable to the OP’s need.
feb 20, 1990 > current date rounded down to date = feb 02 2025 midnight
feb 20, 1990 < current date rounded down to date + 1 day = feb 03 2025 midnight
I would honestly just recommend storing the birth day and birth month, but just for the sake of it, you could technically accomplish this using an advanced filter.
You can just export the day and month from the birthdate using the :export operator.
Then you can run a recurring workflow (or recursive) daily and weekly doing a search for users with an advanced filter where the user's birthdate extract by month equals current date/time:extract month and user's birthdate extract by day equals current date/time: extract day.
As @mitchbaylis said, you should create two fields for both the month and date, then run a bulk workflow to make changes to those fields for existing users. You would just modify it setting it equal to the user’s birthdate then extracting by the month and day respectively.
Then you should store it in your sign up flow or wherever you store the birthdate for future users.
Then run a daily and weekly recurring (or recursive) workflow