Hi Team,
I am working on a Power Automate flow where I need to send notifications based on employees' Date of Joining (DOJ).
My requirement is to compare only the month and day of the DOJ with today’s date (ignoring the year), like an anniversary reminder.
I am using a SharePoint list where the DOJ column is a Date type, and I am looping through items using Apply to each.
What I tried:
In Condition / Compose, I used:
formatDateTime(item()?['DOJ'],'MM-dd')
and compared it with:
formatDateTime(addHours(utcNow(),5.5),'MM-dd')
Issue:
The flow fails with the following error:
InvalidTemplate. The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'.
What I understand:
It seems some records in SharePoint have a null/empty DOJ, which is causing the failure.
What I tried to fix:
I also tried using:
formatDateTime(coalesce(item()?['DOJ'],'1900-01-01'),'MM-dd')
But I am still facing issues in some cases.
Any help would be greatly appreciated.
Thanks in advance!
Pankaj Jangid
Youtube @oyepanky