3

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.

1
  • 2
    Try this - MIN( Year(DateValue(Account.CreatedDate)), Year(DateValue(Account.Wellspring_Create_Date__c)), Year(IF( ISBLANK(Account.Source_System_Created_Date__c), TODAY(), Account.Source_System_Created_Date__c) ), Year(IF( ISBLANK(Account.Peoplesoft_Create_Date__c), TODAY(), Account.Peoplesoft_Create_Date__c) ) )
    – kurunve
    Mar 25, 2016 at 15:08

1 Answer 1

0

The solution, by @kurunve:

MIN( 
     Year(DateValue(Account.CreatedDate)),
     Year(DateValue(Account.Wellspring_Create_Date__c)),
     Year(
          IF( ISBLANK(Account.Source_System_Created_Date__c),
             TODAY(), 
             Account.Source_System_Created_Date__c) ),
     Year(
          IF( ISBLANK(Account.Peoplesoft_Create_Date__c),
             TODAY(),
             Account.Peoplesoft_Create_Date__c) )
    )

Putting the YEAR() function outside of the IF() function solved it. I don't know why.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .