Hoping this is an easy one. I have this formula in a VF page:
MIN(
Year(DateValue(Account.CreatedDate)),
Year(Account.Source_System_Created_Date__c),
Year(DateValue(Account.Wellspring_Create_Date__c)),
Year(Account.Peoplesoft_Create_Date__c)
)
It is working well, but the problem is that it is picking up the blanks. I am trying to get rid of the blanks by using BLANKVALUE
or NULLVALUE
, but they return this error:
Error: Incorrect parameter type for function 'NULLVALUE()'. Expected Number, received Date
I'm sure there is a way to solve this, and there is probably a built in function. But I can't find it.
edit: I even tried:
MIN(
Year(DateValue(Account.CreatedDate)),
Year(DateValue(Account.Wellspring_Create_Date__c)),
IF(ISBLANK(Year(Account.Source_System_Created_Date__c)),
TODAY(),
Year(Account.Source_System_Created_Date__c)),
IF(ISBLANK(Year(Account.Peoplesoft_Create_Date__c)),
TODAY(),
Year(Account.Peoplesoft_Create_Date__c))
)
And I get this error:
Error: Incorrect parameter type for function 'MIN()'. Expected Number, received MISSING LABEL PropertyFile – val null not found in section FormulaFieldExceptionDataTypes
It is worth to note that not all fields are datetime.
Best Answer
The solution, by @kurunve:
Putting the YEAR() function outside of the IF() function solved it. I don't know why.