function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kathleen Elisabeth SmithKathleen Elisabeth Smith 

Reference formula for yesterday's dateTime in the Start Trigger

Hello, I have a Scheduled Trigger on a custom object. I want the flow to only run on records that were created after yesterday's Date/Time. To do this, I created a Date/Time variable that grabs today's date, then I created a formula that takes the variable and subtracts 1, to make it yesterday. Then I go to the start object and put in the conditions "CreatedDate Greater Than or Equal (Yesterday's Date)". However, no matter what I put in for yesterday's date (my formula, date/time straight from the global flow value, etc.) it doesn't accept my field. It either gives me a "We don't recognize that value. Make sure it's a valid date/time value in this format: M/d/yyyy h:mm a" or error that says "The Start element can’t have a record filter condition that references a resource or element. Remove the condition that contains the unsupported value “$Flow.CurrentDateTime” or replace it with a literal value." How do I work around this so that I can get my flow to only run on records that were greated yesterday?

Thank you!
ShirishaShirisha (Salesforce Developers) 
Hi Kathieen,

Greetings!

Have you used the formula as below to get the Yesterday's date to compare it with the Createddate field.
 
TODAY() + (-1), which is yesterday’s date
Reference:https://help.salesforce.com/articleView?id=tips_for_using_date_datetime_formula_fields.htm&type=5

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
 
Kathleen Elisabeth SmithKathleen Elisabeth Smith
Shirisha, I know how to get yesterday's date using the formula, but I'm having issues comparing that formula in the Record Condition of the flow, specifcally in the Value, as seen in the image below. I am getting errors when I put formulas in that field, in my flow. How can I get the Value to accurately compare properly? Thank you.

User-added image
Lisa MensinkLisa Mensink
I am having the same question. I need to trigger a flow on a date that is in a particular field. How do I tell it to trigger if this field is equal to "TODAY" as shown in the "value" field in Kathleen's screen shot above. When I populate a variable with the date value of “$Flow.CurrentDate”  then I get this warning:  The Start element can’t have a record filter condition that references a resource or element. Remove the condition that contains the unsupported value “$Flow.CurrentDate” or replace it with a literal value.
Anitha Seenivasagam 18Anitha Seenivasagam 18
@lisa , I am running to the same prob. Where you able to solve for this? 
Greg DycheGreg Dyche
@peteheld posted https://trailhead.salesforce.com/en/trailblazer-community/feed/0D54S00000Bs0T7SAJ (https://help.salesforce.com/s/articleView?id=000356305&type=1
Seems to say it is a limitation of scheduled flows for right now.
https://help.salesforce.com/s/articleView?id=000356305&type=1  (https://help.salesforce.com/s/articleView?id=000356305&type=1)
Connor SabatkaConnor Sabatka
The way I got around this was a formula field on the object that checks true if the date is greater than Today() - (1)

Ex:
If(
     Connected_Date__c = TODAY() - (1) , TRUE, FALSE
Connor SabatkaConnor Sabatka
Then in the flow I wrote my entry criteria as (new field) = TRUE
sanjayrs23sanjayrs23
Just write TODAY() and it should accept that. The start element does not read resources but can ready any direct value supplied or any inbuilt formula/function like TODAY() is a function so will work. I have similar requirements.
Célio XavierCélio Xavier
In Apex I assigned it to a variable to use in if:

Date YesterdayDate = Date.TODAY() + (-1);