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.

  • 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 '16 at 15:08
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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.