We have a requirement to fetch all accounts whose birthday is after 7 days. i.e. Select id from account where personbirthdate = TODAY()+7
I am looking for a where clause that can return this result.
Alternatively: I am using a formula field on account object for the same.
PersonBirthDayAlertAfter7Days__c = IF(DATE(YEAR(TODAY()),MONTH(PersonBirthdate),DAY(PersonBirthdate)) - TODAY() = 7, True, False)
then using this formula field in query:
Select id from Account where PersonBirthDayAlertAfter7Days__c = TRUE
but it creating an issue with bulk data and processing gets very slow. We can't enable custom indexing on formula field because it is non-deterministic(having TODAY() function).
Any help would be greatly appreciated.