Run Daily
Initialize birthdayDate = '04-30'
Initialize currentDay = utcNow( ) // "2024-04-30T00:00:00.0000000Z"
Initialize substringCurrentDay = substring(variables('currentDay'), 5, 5)
Condition
- birthdayDate isEqual subStringCurrentDay // These are variables we initialized above
true -> Send Email
false -> Don't
---
Explanation
You can get the date by using utcNow( )
Use 'substring(string, index, length)'
- string: variables('currentday')
- index: 5 // We want to start at the month so we use the 5th index to skip '2024-'
- length:5 // We want the month and day so we use a length of 5 to capture '04-30'
If this is for a team, you're most likely going to be looping over an array of objects.
[{name: John, birthday: 1111}, {name:jill, birthday:1111}]
Do the same thing but loop over with a condition of:
- item( )?['birthday'] isEqual substringCurrentDay
true -> Send Email
false -> Don't
---
If the birthday is formatted with '/' instead of '-', you can use replace( )
replace(string, whatYouWantToReplace, whatYou'reReplacingWith)
Example: replace(variable(birthdayDate), '/', '-'
This will allow you to have the same formatted dates