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
Bob 11Bob 11 

f_EndDateTime (Formula) - The formula expression is invalid: Incorrect parameter type for function 'YEAR()'. Expected Date, received DateTime

I am getting the following error when i try to save and activate a flow

f_EndDateTime (Formula) - The formula expression is invalid: Incorrect parameter type for function 'YEAR()'. Expected Date, received DateTime

Here is the formula below:

how would I adjust this formula to stop that error
DATETIMEVALUE(TEXT(YEAR({!End_Date_Time}))+"-" +TEXT(MONTH({!End_Date_Time}))+"-"+TEXT(DAY({!End_Date_Time}))+" 12:00:00")

 
Best Answer chosen by Bob 11
Maharajan CMaharajan C
Hi Bob,

Try the below one:

First you have to convert the End_Date_Time to Date then you can use the Year, Month, Day Functions.
 
DATETIMEVALUE(TEXT(YEAR(DATEVALUE({!End_Date_Time})))+"-" +TEXT(MONTH(DATEVALUE({!End_Date_Time})))+"-"+TEXT(DAY(DATEVALUE({!End_Date_Time})))+" 12:00:00")

Thanks,
Maharajan.C

 

All Answers

Maharajan CMaharajan C
Hi Bob,

Try the below one:

First you have to convert the End_Date_Time to Date then you can use the Year, Month, Day Functions.
 
DATETIMEVALUE(TEXT(YEAR(DATEVALUE({!End_Date_Time})))+"-" +TEXT(MONTH(DATEVALUE({!End_Date_Time})))+"-"+TEXT(DAY(DATEVALUE({!End_Date_Time})))+" 12:00:00")

Thanks,
Maharajan.C

 
This was selected as the best answer
Bob 11Bob 11
Thannk you so much for helping Maharajan! That worked!